Repository navigation
test: end-to-end check of the review page (do not merge) #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e202360
feat: the HTML report writes snap_diff_manifest.json beside it
pftg cad1db7
feat: a review page that accepts or rejects screenshots from a PR
pftg 0f9b141
test: drive the review page against a fake GitHub API
pftg d98318e
fix: the review page no longer shows "null" for a new screenshot
pftg 14f7a2f
fix: the manifest names each screenshot by its path from the git root
pftg e56aea4
feat: install and auto-update the review page on a project's GitHub P…
pftg 552eb0a
ci: upload this suite's HTML report from where it is written
pftg 6584b68
fix: link the review page only when it is actually served
pftg 73023a4
fix: the manifest lists each screenshot file once, and only files in …
pftg f797a96
refactor: one size-capped body reader in the review page, leaner comm…
pftg 32d8872
revert: drop the GitHub Pages review page
pftg d19dbf8
feat: Accept and Reject in the CI report build the PR comment that ac…
pftg 6f770ed
feat: accept screenshots by PR comment, carried out with the reposito…
pftg c9a3aaf
fix: the manifest drops a file re-recorded later; clean removes it; a…
pftg 15ad84b
docs: accept screenshots from the pull request
pftg 5d38a7e
feat: one Commit decisions button in the report, through a prefilled …
pftg 9c12b87
test: e2e of the review flow (do not merge)
pftg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
471 changes: 471 additions & 0 deletions
471
.github/actions/accept-screenshots/accept_screenshots.rb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| name: 'Accept SnapDiff screenshots' | ||
| description: >- | ||
| Commit screenshot baselines accepted in a PR comment or a new issue | ||
| (`/snap-diff accept run=<run id> [pr=<n>] <file>@<hash> ...`) from that run's report artifact. | ||
| Run it from an issue_comment + issues workflow gated to OWNER/MEMBER/COLLABORATOR. | ||
| inputs: | ||
| token: | ||
| description: 'Token with contents: write, pull-requests: write, issues: write, actions: read (actions: write to dispatch ci-workflow); reads the author''s permission' | ||
| default: ${{ github.token }} | ||
| screenshots-path: | ||
| description: 'Every accepted file must be committed under this directory (relative to the repository root)' | ||
| default: 'doc/screenshots' | ||
| ci-workflow: | ||
| description: >- | ||
| Optional workflow file name (with workflow_dispatch) to run on the PR branch after the commit. | ||
| A push made with GITHUB_TOKEN does not start workflows; a workflow_dispatch does. | ||
| default: '' | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Accept screenshots | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| CI_WORKFLOW: ${{ inputs.ci-workflow }} | ||
| SCREENSHOTS_PATH: ${{ inputs.screenshots-path }} | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| # issue_comment: the comment on the PR; issues: the new issue itself. | ||
| BODY: ${{ github.event_name == 'issues' && github.event.issue.body || github.event.comment.body }} | ||
| AUTHOR: ${{ github.event_name == 'issues' && github.event.issue.user.login || github.event.comment.user.login }} | ||
| AUTHOR_ASSOCIATION: ${{ github.event_name == 'issues' && github.event.issue.author_association || github.event.comment.author_association }} | ||
| run: ruby "$GITHUB_ACTION_PATH/accept_screenshots.rb" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| name: Accept screenshots | ||
|
|
||
| # The report's "Commit decisions" button opens a new issue whose body is the | ||
| # review command (or a maintainer pastes it as a PR comment): | ||
| # /snap-diff accept run=<run id> [pr=<n>] <file>@<hash> ... | ||
| # The action commits those files from that run's report artifact to the PR branch. | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [ created ] | ||
| issues: | ||
| types: [ opened ] | ||
|
|
||
| jobs: | ||
| accept: | ||
| if: >- | ||
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && | ||
| startsWith(github.event.comment.body, '/snap-diff ') && | ||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || | ||
| (github.event_name == 'issues' && | ||
| startsWith(github.event.issue.body, '/snap-diff ') && | ||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
| actions: write | ||
| # Per PR for comments, per issue for issues (the PR is not known yet); | ||
| # two issues for one PR may run at once, and the push lease lets only one land. | ||
| concurrency: | ||
| group: snap-diff-accept-${{ github.event.issue.number }} | ||
| cancel-in-progress: false | ||
| steps: | ||
| # The default branch (the ref of both events): this repository's trusted | ||
| # code, needed for the local action. The PR's code is never checked out here. | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: ./.github/actions/accept-screenshots | ||
| with: | ||
| screenshots-path: test/fixtures/app/doc/screenshots | ||
| ci-workflow: test.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
| *.diff.png | ||
| *.base.png | ||
| snap_diff_report.html | ||
| snap_diff_manifest.json | ||
|
|
||
| *.attempt_*.webp | ||
| *.diff.webp | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Keep full-suite coverage in the required pull-request check.
The
matrixjob is skipped for ordinary pull requests unless special conditions apply. This change makesfunctional-testrun onlytest/integration/browser_screenshot_test.rb, so normal pull requests no longer run the unit and integration suite.Keep the full suite in this required job and add a separate browser-only job, or enable the matrix job for pull requests. Restore this before merging the workflow.
🧰 Tools
🪛 zizmor (1.30.1)
[warning] 3-279: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents