Skip to content

ci: add a PR proof check for changes users can see - #596

Merged
tieubao merged 6 commits into
developfrom
chore/pr-ui-proof-rule
Nov 24, 2026
Merged

tieubao merged 6 commits into
developfrom
chore/pr-ui-proof-rule

Conversation

@tieubao

@tieubao tieubao commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What and why

Adds a PR proof check. A pull request into develop that changes what users see (Settings, the arrow, a notice, strings, storyboards, assets) now fails the check unless the description ticks "This PR changes nothing users see", carries an image or video, or the diff adds a PNG, JPG, GIF, WebP, MP4 or MOV under docs/verification/. Bots and PRs against other branches pass. The rule lives in scripts/pr-proof-check.sh, the workflow in .github/workflows/pr-proof.yml, and the PR template and CONTRIBUTING.md now explain it.

The workflow uses pull_request (never pull_request_target), a read-only token, no secrets, a pinned actions/checkout (the SHA is the commit behind tag v7.0.1, the same pin as ci.yml) and the explicit ubuntu-24.04 image. The PR body is read with gh and never placed on a command line.

Fixed while reviewing the branch: a flag with no value (for example a trailing --body) looped forever under bash 3.2, so it now exits 2. Only [bot] and app/ logins count as bots, so a human login such as dependabot-fan is checked. Changed paths are printed with printf %q behind a bullet, so a fork file name cannot start a workflow command line in the job log.

How it was tested

bash scripts/test-pr-proof-check.sh under macOS /bin/bash 3.2.57, with no network, no app and no Xcode build. Each case runs the script on a throwaway body and file list. The run record is kept locally at docs/verification/pr-proof-check.md (the repo ignores everything but PNG files in that folder).

Case Command Result
UI PR without proof fails bash scripts/pr-proof-check.sh --body empty.md --files ui.txt exit 1, PR proof: FAILED. This PR changes files that look like UI, and shows no proof.
UI PR with an image passes bash scripts/pr-proof-check.sh --body image.md --files ui.txt exit 0, PR proof: the description has an image or video. Pass.
Opt-out tick passes bash scripts/pr-proof-check.sh --body tick.md --files ui.txt exit 0, PR proof: the box 'changes nothing users see' is ticked. Pass.
Non-UI PR passes bash scripts/pr-proof-check.sh --body empty.md --files nonui.txt exit 0, PR proof: no changed path looks like UI. Pass.
Bot passes bash scripts/pr-proof-check.sh --body empty.md --files ui.txt --bot exit 0, PR proof: bot author. Nothing to check.
Non-develop base passes bash scripts/pr-proof-check.sh --body empty.md --files ui.txt --base release/v1.13 exit 0, PR proof: base is release/v1.13, not develop. Nothing to check.
Full suite bash scripts/test-pr-proof-check.sh passed checks: 40 failed checks: 0, ALL GREEN
Negative control, missing proof final exit 1 of the script changed to exit 0 exit 1, passed checks: 20 failed checks: 11
Negative control, flag with no value the missing-value guard removed exit 1, passed checks: 30 failed checks: 1
Negative control, path with a space paths cut at the first space (path="${path%% *}") exit 1, passed checks: 38 failed checks: 2, FAILED: [a UI path with a space is read whole] [a UI path with a space is named escaped]
Negative control, bot pattern the *"[bot]" pattern deleted exit 1, passed checks: 39 failed checks: 1, FAILED: [bot login passes]
Restored, rerun each script restored from a saved copy, then the suite passed checks: 40 failed checks: 0, ALL GREEN
Open PR #594 (pt-BR localization) dry run body, author and file list fetched with gh, then the script exit 0, PR proof: the description has an image or video. Pass. (13 files, base develop)

The check's own run on this PR is listed in the checks below.

UI proof

This PR touches no Swift, strings, storyboards or assets. It adds a CI workflow, two shell scripts, the PR template and CONTRIBUTING text.

Tick exactly one:

  • This PR changes something users see, and the proof is above
  • This PR changes nothing users see

Add a pull request template with a UI proof section and two checkboxes.
CONTRIBUTING.md gets a UI proof subsection, and the branch name lines now
match the type/slug names the repo uses (feat, fix, docs, chore, test).
A pull request that touches UI paths (Settings, Preferences, StatusBar,
Notice, Palette, Presentation, Arrivals, About Swift files, strings,
storyboards, xibs, asset catalogs) must show an image, a PNG under
docs/verification/, or tick "changes nothing users see". The rule lives in
scripts/pr-proof-check.sh with an offline test. The workflow uses
pull_request, a read-only token and an explicit Linux image.
A trailing flag with no value looped forever under bash 3.2 because shift 2 fails on one argument. Add a test for it and record the verification run.
Only [bot] and app/ logins count as bots, changed paths are printed escaped so a file name cannot start a workflow command, and the tests now cover spaced UI paths, array-passed arguments, xib files, upper-case PNG proof, CRLF bodies and human logins that start with a bot name. The run record leaves the tree because the repo ignores non-PNG files under docs/verification.
@tieubao
tieubao merged commit ebe79f2 into develop Nov 24, 2026
4 checks passed
@tieubao
tieubao deleted the chore/pr-ui-proof-rule branch November 24, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant