chore(deps): bump actions/setup-node from 4 to 7 #335
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
| name: ui-screenshot-gate | |
| on: | |
| pull_request_target: # zizmor: ignore[dangerous-triggers] reads PR body/files as data only; never checks out or runs head code | |
| types: [opened, reopened, edited] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| gate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # base ref => trusted logic. body/files come from the API as data, never | |
| # interpolated into the shell (avoids PR-body script injection). | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: "3.12" | |
| - name: fetch changed files + body (as files, not interpolated) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| REPO: ${{ github.repository }} | |
| PR: ${{ github.event.pull_request.number }} | |
| run: | | |
| gh pr view "$PR" --repo "$REPO" --json files --jq '.files[].path' > changed.txt | |
| gh pr view "$PR" --repo "$REPO" --json body --jq '.body // ""' > body.txt | |
| - name: close UI PR lacking before/after screenshots | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| REPO: ${{ github.repository }} | |
| PR: ${{ github.event.pull_request.number }} | |
| run: | | |
| # core wins over ui — never close a core PR. | |
| if PYTHONPATH=src python -m vouch.pr_bot core-touched --files-file changed.txt; then | |
| echo "core PR — screenshot gate does not apply"; exit 0 | |
| fi | |
| if ! PYTHONPATH=src python -m vouch.pr_bot ui-touched --files-file changed.txt; then | |
| echo "not a UI PR — gate does not apply"; exit 0 | |
| fi | |
| if PYTHONPATH=src python -m vouch.pr_bot has-screenshots --body-file body.txt; then | |
| echo "before/after screenshots present — ok"; exit 0 | |
| fi | |
| gh pr comment "$PR" --repo "$REPO" --body \ | |
| "this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add **before** and **after** screenshots, then reopen." | |
| gh pr close "$PR" --repo "$REPO" |