v0.6.0 aba298d

actions_markers.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package executor
4
5import (
6	"strconv"
7	"strings"
8)
9
10// The start-action and end-action markers the runner prints around each step of
11// a composite action (CompositeActionHandler.RunStepsAsync, :323 and :415-466).
12// GitHub's runner emits them when the EmitCompositeMarkers feature is on, which
13// is the case for the recorded runs, so they are always printed here.
14
15// maxMarkerDisplayName is CompositeActionHandler.MaxDisplayNameLength.
16const maxMarkerDisplayName = 1000
17
18// markerEscaper is ActionCommand.EscapeValue (ActionCommand.cs:211-225): the
19// escape mappings applied last to first, so that "%" goes first and nothing is
20// escaped twice.
21var markerEscaper = strings.NewReplacer("%", "%25", "]", "%5D", "\n", "%0A", "\r", "%0D", ";", "%3B")
22
23// sanitizeDisplayName is CompositeActionHandler.SanitizeDisplayName (:552): the
24// first line without its leading white space, cut to 1000 UTF-16 code units.
25func sanitizeDisplayName(name string) string {
26	r := firstLine(name)
27	units := 0
28	for i, c := range r {
29		w := 1
30		if c >= 0x10000 {
31			w = 2
32		}
33		if units+w > maxMarkerDisplayName {
34			return r[:i]
35		}
36		units += w
37	}
38	return r
39}
40
41func startMarker(display, id string) string {
42	return "##[start-action display=" + markerEscaper.Replace(sanitizeDisplayName(display)) + ";id=" + markerEscaper.Replace(id) + "]"
43}
44
45func endMarker(id, outcome, conclusion string, ms int64) string {
46	return "##[end-action id=" + markerEscaper.Replace(id) + ";outcome=" + outcome + ";conclusion=" + conclusion + ";duration_ms=" + strconv.FormatInt(ms, 10) + "]"
47}
48
49// markerResult is TaskResult.ToActionResult in lower case.
50func markerResult(r stepResult) string {
51	switch r {
52	case resFailed:
53		return "failure"
54	case resCanceled:
55		return "cancelled"
56	case resSkipped:
57		return "skipped"
58	}
59	return "success"
60}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 4

Tags 11

↑↓ moveenter openesc close