main 98594d0

skip_test.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package workflow
4
5import "testing"
6
7// TestSkipCI replays the commit messages pushed by the recorded scenarios
8// skip-directives, skip-directives-placement, skip-checks-trailer and
9// skip-directive-tag. skip is true when GitHub started no run.
10func TestSkipCI(t *testing.T) {
11	tests := []struct {
12		scenario, msg string
13		skip          bool
14	}{
15		// skip-directives
16		{"skip-directives 1", "change one [skip ci]", true},
17		{"skip-directives 2", "change two [ci skip]", true},
18		{"skip-directives 3", "change three [no ci]", true},
19		{"skip-directives 4", "change four [skip actions]", true},
20		{"skip-directives 5", "change five [actions skip]", true},
21		{"skip-directives 6", "change six, no directive", false},
22
23		// skip-directives-placement
24		{"placement 1 body", "subject\n\nbody line [skip ci] more body", true},
25		{"placement 2 mid-subject", "prefix [skip ci] suffix", true},
26		{"placement 3 upper case", "upper case [SKIP CI]", false},
27		{"placement 4 mixed case", "mixed case [Skip Ci]", false},
28		{"placement 5 near miss dash", "near miss [skip-ci]", false},
29		{"placement 6 no brackets", "near miss skip ci without brackets", false},
30		{"placement 7 extra word", "near miss [skip ci please]", false},
31		{"placement 8 NO_CI", "marker ***NO_CI*** in subject", false},
32		{"placement 9 SKIP_CI", "marker ***SKIP_CI*** in subject", false},
33
34		// skip-checks-trailer
35		{"trailer 1 one blank line", "trailer true\n\nskip-checks: true", false},
36		{"trailer 2 false, one blank line", "trailer false\n\nskip-checks: false", false},
37		{"trailer 3 upper, one blank line", "trailer upper\n\nSkip-Checks: true", false},
38		{"trailer 4 other trailer first", "trailer after other trailer\n\nSigned-off-by: A Person <a@example.invalid>\nskip-checks: true", false},
39		{"trailer 5 in the subject", "not a trailer, in the subject skip-checks: true", false},
40		{"trailer 6 no blank line", "trailer without blank line\nskip-checks: true", false},
41		{"trailer 7 two blank lines", "two blank lines true\n\n\nskip-checks: true", true},
42		{"trailer 8 no space", "two blank lines no space\n\n\nskip-checks:true", true},
43		{"trailer 9 false", "two blank lines false\n\n\nskip-checks: false", false},
44		{"trailer 10 value upper", "two blank lines upper\n\n\nSkip-Checks: TRUE", false},
45		{"trailer 11 text after", "two blank lines then more text\n\n\nskip-checks: true\nand more", false},
46		{"trailer 12 after other trailer", "two blank lines after other trailer\n\n\nSigned-off-by: A Person <a@example.invalid>\nskip-checks: true", false},
47		{"trailer 13 trailing spaces", "two blank lines trailing spaces\n\n\nskip-checks: true  ", true},
48		{"trailer 14 yes", "two blank lines yes\n\n\nskip-checks: yes", false},
49		{"trailer 15 key upper", "two blank lines key upper value lower\n\n\nSkip-Checks: true", false},
50		{"trailer 16 value upper", "two blank lines key lower value upper\n\n\nskip-checks: TRUE", false},
51		{"trailer 17 key mixed", "two blank lines key mixed\n\n\nSkip-checks: true", false},
52		{"trailer 18 plain", "plain commit", false},
53
54		// skip-directive-tag: the message of the commit a tag points at.
55		{"tag 1", "tagged [skip ci]", true},
56		{"tag 2", "tagged normally", false},
57
58		// Not recorded: see the doc comment of SkipCI.
59		{"trailing newline", "x\n\n\nskip-checks: true\n", true},
60		{"crlf", "x\r\n\r\n\r\nskip-checks: true\r\n", true},
61		{"three blank lines", "x\n\n\n\nskip-checks: true", true},
62		{"trailer alone", "\n\n\nskip-checks: true", false},
63		// A line with only white space is not blank (GO-006, assumed).
64		{"space-only lines before trailer", "x\n \n \nskip-checks: true", false},
65		{"one space-only line before trailer", "x\n\n \nskip-checks: true", false},
66		{"tab-only lines before trailer", "x\n\t\n\t\nskip-checks: true", false},
67		{"empty", "", false},
68	}
69	for _, tc := range tests {
70		if got := SkipCI(tc.msg); got != tc.skip {
71			t.Errorf("%s: SkipCI(%q) = %v, want %v", tc.scenario, tc.msg, got, tc.skip)
72		}
73	}
74}

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 1

Tags 3

↑↓ moveenter openesc close