Skip to content

Commit 142cef5

Browse files
ci(docspublish): make cli_interactive gif regeneration deterministic
VHS occasionally renders byte-different gifs from identical sources, so every push to master produced a noisy `docs(cli/screenshots)` auto-commit even when nothing affecting the rendered output had changed. Make the workflow only commit regenerated gifs when render inputs actually changed in the push -- the tape sources or the `commitizen/` package the tapes execute -- or on manual dispatch, and pin VHS to v0.11.0 so deliberate refreshes are reproducible across runs. Also rewrite all five `*.tape` files to wait for cz prompt strings via `Wait+Screen /.../` instead of fixed `Sleep` delays. This removes the remaining nondeterministic frame-timing source and makes future cz prompt changes fail fast (15s Wait timeout) instead of producing a silently wrong gif. Generated-by: GitHub Copilot CLI (claude-opus-4.7-1m-internal) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 286da54 commit 142cef5

6 files changed

Lines changed: 108 additions & 67 deletions

File tree

.github/workflows/docspublish.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,43 @@ jobs:
2525
run: |
2626
sudo apt update
2727
sudo apt install -y ffmpeg ttyd
28-
go install github.com/charmbracelet/vhs@latest
28+
# Pin VHS to a known version so gif rendering is deterministic across runs.
29+
# Bump this version intentionally when you want to refresh all interactive screenshots.
30+
go install github.com/charmbracelet/vhs@v0.11.0
2931
- name: Install dependencies
3032
run: |
3133
uv --version
3234
uv sync --frozen --group base --group script
3335
- name: Update CLI screenshots
3436
run: |
3537
uv run --no-sync poe doc:screenshots
38+
- name: Discard cli_interactive regeneration when render inputs are unchanged
39+
# VHS gif output drifts by a few bytes between runs even when sources are
40+
# identical, which used to produce a noisy stream of `docs(cli/screenshots)`
41+
# commits. Keep regenerated gifs only when something that can actually
42+
# change the rendered content has changed in this push (the tape sources,
43+
# or any commitizen source code the tapes execute), or when manually
44+
# dispatched.
45+
run: |
46+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
47+
echo "Manual run; keeping any regenerated cli_interactive gifs."
48+
exit 0
49+
fi
50+
before="${{ github.event.before }}"
51+
if [[ -z "$before" || "$before" == "0000000000000000000000000000000000000000" ]]; then
52+
echo "No previous SHA available (first push or new branch); keeping any regenerated cli_interactive gifs."
53+
exit 0
54+
fi
55+
if ! git rev-parse --verify "$before^{commit}" >/dev/null 2>&1; then
56+
echo "Previous SHA $before is unreachable; keeping any regenerated cli_interactive gifs."
57+
exit 0
58+
fi
59+
if git diff --quiet "$before" HEAD -- docs/images/'*.tape' docs/images/shared/ commitizen/; then
60+
echo "Tape sources and commitizen/ unchanged since $before; discarding cli_interactive gif regeneration to avoid byte-level churn."
61+
git checkout -- docs/images/cli_interactive/
62+
else
63+
echo "Render inputs changed since $before (tapes or commitizen/); keeping regenerated cli_interactive gifs."
64+
fi
3665
- name: Commit and push updated CLI screenshots
3766
run: |
3867
git config --global user.name "github-actions[bot]"

docs/images/bump.tape

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@ Type "cz bump"
5757
Sleep 500ms
5858
Enter
5959

60-
# Wait for the "Is this the first tag created?" prompt
61-
Sleep 2s
60+
# Wait for the "Is this the first tag created?" prompt to render
61+
Wait+Screen /Is this the first tag/
62+
63+
# Small visual pause so the prompt is readable before the answer
64+
Sleep 500ms
6265

6366
# Answer Yes to "Is this the first tag created?" (default is Yes, just press Enter)
6467
Enter
65-
Sleep 3s
68+
69+
# Wait for cz bump to finish (the "Done!" success line is printed last)
70+
Wait+Screen /Done!/
6671

6772
# Step 3: Show new version after bump
6873
Type "cz version --project"

docs/images/commit.tape

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,41 @@ Type "cz commit"
2929
Sleep 500ms
3030
Enter
3131

32-
# Wait for first prompt to appear
33-
Sleep 1s
34-
35-
# Question 1: Select the type of change (move down to "feat")
32+
# Q1: prefix -- select the type of change (move down to "feat")
33+
Wait+Screen /Select the type of change/
34+
Sleep 500ms
3635
Down
3736
Sleep 500ms
3837
Enter
39-
Sleep 1s
4038

41-
# Question 2: Scope (optional, skip)
39+
# Q2: scope (optional, skip)
40+
Wait+Screen /What is the scope/
41+
Sleep 500ms
4242
Enter
43-
Sleep 1s
4443

45-
# Question 3: Subject
44+
# Q3: subject
45+
Wait+Screen /imperative summary/
46+
Sleep 500ms
4647
Type "awesome new feature"
4748
Sleep 500ms
4849
Enter
49-
Sleep 1s
5050

51-
# Question 4: Is this a BREAKING CHANGE? (No)
51+
# Q4: body (optional, skip)
52+
Wait+Screen /additional contextual information/
53+
Sleep 500ms
5254
Enter
53-
Sleep 1s
5455

55-
# Question 5: Body (optional, skip)
56+
# Q5: is_breaking_change (No)
57+
Wait+Screen /BREAKING CHANGE\?/
58+
Sleep 500ms
5659
Enter
57-
Sleep 1s
5860

59-
# Question 6: Footer (optional, skip)
61+
# Q6: footer (optional, skip)
62+
Wait+Screen /Footer\. Information/
63+
Sleep 500ms
6064
Enter
61-
Sleep 1s
6265

6366
# Wait for commit success message
64-
Sleep 1s
67+
Sleep 2s
6568

6669
Source shared/cleanup.tape

docs/images/init.tape

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,55 @@ Type "cz init"
1515
Sleep 500ms
1616
Enter
1717

18-
# Wait for welcome message and first prompt
19-
Sleep 500ms
20-
Sleep 1s
21-
22-
# Question 1: Please choose a supported config file
18+
# Q1: Please choose a supported config file
2319
# Default is .cz.toml, just press Enter
20+
Wait+Screen /Please choose a supported config/
21+
Sleep 500ms
2422
Enter
25-
Sleep 1s
2623

27-
# Question 2: Please choose a cz (commit rule)
24+
# Q2: Please choose a cz (commit rule)
2825
# Default is cz_conventional_commits, just press Enter
26+
Wait+Screen /Please choose a cz/
27+
Sleep 500ms
2928
Enter
30-
Sleep 1s
3129

32-
# Question 3: Choose the source of the version
33-
# Default is "commitizen: Fetch and set version in commitizen config, just press Enter"
30+
# Q3: Choose the source of the version
31+
# Default is "commitizen", just press Enter
32+
Wait+Screen /Choose the source of the version/
33+
Sleep 500ms
3434
Enter
35-
Sleep 1s
3635

37-
# Question 4: Choose version scheme
36+
# Q4: Choose version scheme
3837
# Default is semver, just press Enter
38+
Wait+Screen /Choose version scheme/
39+
Sleep 500ms
3940
Enter
40-
Sleep 1s
4141

42-
# Question 5: Please enter the correct version format
42+
# Q5: Please enter the correct version format
4343
# Default is "$version", just press Enter
44+
Wait+Screen /Please enter the correct version format/
45+
Sleep 500ms
4446
Enter
45-
Sleep 1s
4647

47-
# Question 6: Create changelog automatically on bump
48+
# Q6: Create changelog automatically on bump
4849
# Default is Yes, just press Enter
50+
Wait+Screen /Create changelog automatically on bump/
51+
Sleep 500ms
4952
Enter
50-
Sleep 1s
5153

52-
# Question 7: Keep major version zero (0.x) during breaking changes
54+
# Q7: Keep major version zero (0.x) during breaking changes
5355
# Default is Yes, just press Enter
56+
Wait+Screen /Keep major version zero/
57+
Sleep 500ms
5458
Enter
55-
Sleep 1s
5659

57-
# Question 8: What types of pre-commit hook you want to install?
58-
# Default is [commit-msg], just press Enter to accept
60+
# Q8: What types of pre-commit hook you want to install?
61+
# Default is [], just press Enter to accept
62+
Wait+Screen /types of pre-commit hook/
63+
Sleep 500ms
5964
Enter
60-
Sleep 1s
6165

6266
# Wait for completion message
63-
Sleep 1s
67+
Sleep 2s
6468

6569
Source shared/cleanup.tape

docs/images/shortcut_custom.tape

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,21 @@ Type "cz commit"
8383
Sleep 500ms
8484
Enter
8585

86-
# Wait for first prompt to appear
87-
Sleep 2s
88-
89-
# Question 1: Select the type of change (press d to "docs")
86+
# Q1: prefix -- press "d" shortcut for "docs"
87+
Wait+Screen /Select the type of change/
9088
Sleep 1s
9189
Type "d"
9290
Sleep 2s
9391
Enter
94-
Sleep 1s
9592

96-
# Question 2: Commit body
93+
# Q2: Commit body
94+
Wait+Screen /Commit body/
95+
Sleep 500ms
9796
Type "demo with custom keys"
9897
Sleep 500ms
9998
Enter
100-
Sleep 500ms
10199

102100
# Wait for commit success message
103-
Sleep 1s
101+
Sleep 2s
104102

105103
Source shared/cleanup.tape

docs/images/shortcut_default.tape

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,41 @@ Type "cz commit"
4242
Sleep 500ms
4343
Enter
4444

45-
# Wait for first prompt to appear
46-
Sleep 2s
47-
48-
# Question 1: Select the type of change (press d to "docs")
45+
# Q1: prefix -- press "d" shortcut for "docs"
46+
Wait+Screen /Select the type of change/
4947
Sleep 1s
5048
Type "d"
5149
Sleep 2s
5250
Enter
53-
Sleep 1s
5451

55-
# Question 2: Scope (optional, skip)
52+
# Q2: scope (optional, skip)
53+
Wait+Screen /What is the scope/
54+
Sleep 500ms
5655
Enter
57-
Sleep 1s
5856

59-
# Question 3: Subject
57+
# Q3: subject
58+
Wait+Screen /imperative summary/
59+
Sleep 500ms
6060
Type "demo with custom keys"
6161
Sleep 500ms
6262
Enter
63-
Sleep 500ms
6463

65-
# Question 4: Is this a BREAKING CHANGE? (No)
66-
Enter
64+
# Q4: body (optional, skip)
65+
Wait+Screen /additional contextual information/
6766
Sleep 500ms
68-
69-
# Question 5: Body (optional, skip)
7067
Enter
71-
Sleep 500ms
7268

73-
# Question 6: Footer (optional, skip)
69+
# Q5: is_breaking_change (No)
70+
Wait+Screen /BREAKING CHANGE\?/
71+
Sleep 500ms
7472
Enter
73+
74+
# Q6: footer (optional, skip)
75+
Wait+Screen /Footer\. Information/
7576
Sleep 500ms
77+
Enter
7678

7779
# Wait for commit success message
78-
Sleep 1s
80+
Sleep 2s
7981

8082
Source shared/cleanup.tape

0 commit comments

Comments
 (0)