Skip to content

ci: skip heavy test suites on bot version-bump PRs (PER-9560)#2284

Merged
AkashBrowserStack merged 4 commits into
masterfrom
PER-9560_skip-tests-version-bump-prs
Jun 16, 2026
Merged

ci: skip heavy test suites on bot version-bump PRs (PER-9560)#2284
AkashBrowserStack merged 4 commits into
masterfrom
PER-9560_skip-tests-version-bump-prs

Conversation

@AkashBrowserStack

@AkashBrowserStack AkashBrowserStack commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Automated version-bump PRs — opened by version-bump.yml — only touch lerna.json + packages/**/package.json and have no code impact, yet they currently block ~1h waiting on the full Linux (test.yml) and Windows (windows.yml) test matrices (PER-9560).

This skips those heavy suites for the release bot's version-bump PRs, while keeping them fully in force everywhere else.

The skip fires only when ALL THREE hold (evaluated per push):

  • the head branch matches release/* (the convention set by version-bump.yml — a slash, not the release-* hyphen in the ticket),
  • the PR was opened by github-actions[bot] (github.event.pull_request.user.login), and
  • the PR diff is confined to version files — a changes job lists the PR's changed files (gh api .../pulls/N/files) and confirms every one is lerna.json or a top-level packages/<pkg>/package.json.

The diff check is the load-bearing one and is re-evaluated on every push, so if a source commit lands on a release/* branch after the bot opens the PR, version_only becomes false and the full suite runs — author/branch are fixed at PR-creation time and can't mask a later source change. The check is fail-safe: any API error (or a non-version file) → version_only=false → full CI runs.

What's skipped vs kept

Workflow / job Bot release/* PR, version-only diff Everything else
test.ymlbuild, test (17-pkg matrix), regression skipped (~1h saved) runs
windows.ymlbuild, test (17-pkg matrix) skipped (~60m saved) runs
lint, typecheck, Semgrep run (~1m each) run

Why a job-level if, not an on: branch filter

The test jobs are required status checks. A skipped job posts a "skipped" conclusion that satisfies branch protection, whereas an on:-level skip leaves required checks stuck "pending" and would block the release PR from ever merging.

Also adds a least-privilege permissions: block (contents: read + pull-requests: read, the latter for listing PR files).

Verified end-to-end (on a fork of percy/cli)

  • Bot version-bump PR (github-actions[bot], release/1.32.0-beta.10, version-only diff) → Build/Test/Regression (Linux) and Build/Test (Windows) reported skipped; changes computed version_only=true; lint/typecheck/Semgrep ran.
  • Normal PR (non-version file, human author) → changes computed version_only=false and the heavy Build/Test jobs ran.

Note: the first iteration used dorny/paths-filter with predicate-quantifier: every, which (verified on the fork) never matched — every requires a file to match all patterns at once, so version_only was always false and the skip never fired. Replaced with the explicit file-list check above.

Test plan

  • Bot version-bump PR → heavy jobs skipped; lint/typecheck/Semgrep run; mergeable in ~1m.
  • Push a source commit onto a release/* branch → version_only flips false → full matrices run.
  • Human PR from a release/* branch → runs (author isn't the bot).
  • Normal feature PR / master push / workflow_dispatch → unchanged; everything runs.

🤖 Generated with Claude Code

Automated version-bump PRs (opened by version-bump.yml from
`release/<version>` branches) only touch lerna.json + package.json and
have no code impact, yet they block ~1h on the full Linux + Windows test
matrices. Skip those suites for these PRs.

Skip only when BOTH hold: the head branch is `release/*` AND the PR diff
is confined to the version files version-bump.yml is allowed to commit
(lerna.json + packages/**/package.json), computed by a `changes` job via
dorny/paths-filter (predicate-quantifier: every). So a `release/*` PR
that touches source still runs the full suite — the skip can't be abused
to land untested code behind a green-looking "skipped" check.

- Gate `build`, `test`, `regression` in test.yml and `build` + `test` in
  windows.yml on
  `!(startsWith(github.head_ref,'release/') && needs.changes.outputs.version_only=='true')`.
- Branch pattern is `release/*` (slash) — the convention set by
  version-bump.yml — not `release-*` (hyphen) as the ticket guessed.
- Done as a job-level `if`, not an `on:` branch filter: a skipped job
  posts a "skipped" check that satisfies required status checks, whereas
  an `on:`-level skip leaves required checks "pending" and would block
  the release PR from merging.
- lint, typecheck, and Semgrep (all ~1m) keep running on release PRs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AkashBrowserStack AkashBrowserStack added the 🧹 maintenance General maintenance label Jun 15, 2026
@AkashBrowserStack AkashBrowserStack marked this pull request as ready for review June 15, 2026 13:08
@AkashBrowserStack AkashBrowserStack requested a review from a team as a code owner June 15, 2026 13:08
@AkashBrowserStack AkashBrowserStack changed the title ci: skip heavy test suites on version-only version-bump PRs (PER-9560) ci: skip heavy test suites on bot version-bump PRs (PER-9560) Jun 15, 2026
AkashBrowserStack and others added 3 commits June 15, 2026 21:00
…PER-9560)

Refines the version-bump test skip from the earlier version-only diff
approach to a check on the PR author. Skipping now requires the head
branch to be `release/*` AND the PR to be opened by `github-actions[bot]`.

The bot-identity check is native to GitHub — no extra `changes` job that
could fail and silently skip tests — and fully closes the "a human names
a branch `release/*` to dodge CI" hole; only the release bot's PRs skip.

- Replace the per-job `if` with
  `!(startsWith(github.head_ref,'release/') && github.event.pull_request.user.login=='github-actions[bot]')`
  on build/test/regression (test.yml) and build/test (windows.yml).
- Drop the `changes` job and the `dorny/paths-filter` dependency.
- Keep a least-privilege `permissions: contents: read` block on both
  workflows (no longer need `pull-requests: read`).
- Remove the explanatory comments per review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author + branch alone is not a safe skip gate: github.event.pull_request
.user.login is fixed at PR creation, so commits pushed to a release/*
branch *after* the bot opens the PR keep the same author and branch and
would skip CI on untested source.

Re-add the `changes` job (dorny/paths-filter, SHA-pinned to v3.0.3) and
require version_only on every heavy job, so the skip now needs all three:
branch is release/* AND author is github-actions[bot] AND the diff is
confined to lerna.json + packages/**/package.json. paths-filter
re-evaluates the whole PR diff on each push, so any non-version file
flips version_only to false and tests run again.

- Restore `permissions: pull-requests: read` (paths-filter reads PR files).
- build needs [changes]; test/regression need [build, changes].

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ER-9560)

The dorny/paths-filter gate never matched: predicate-quantifier 'every'
means a file must match *every* pattern, so no file could be both
lerna.json AND packages/**/package.json -> version_only was always false
-> the skip never fired.

Replace it with an explicit check that lists the PR's changed files via
`gh api .../pulls/N/files` and confirms every one is lerna.json or a
top-level packages/<pkg>/package.json. Fail-safe: any API error or a
non-version file -> version_only=false -> full CI runs. Also drops the
third-party action (and its SHA pin / Node-20 deprecation).

Verified end-to-end on a fork of percy/cli:
- bot version-bump PR (release/*, version-only diff) -> Build/Test/
  Regression (Linux) and Build/Test (Windows) reported "skipped".
- normal PR (non-version file) -> heavy jobs ran.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@pranavz28 pranavz28 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkashBrowserStack

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code Review — stack:pr-review

PR: #2284Head: 6a84443Reviewers: stack:percy-cli-code-reviewer (harness percy-cli stack) + inline 18-row checklist

Summary: Skips the heavy Linux/Windows test matrices on automated version-bump PRs — gated per heavy job on release/* branch AND github-actions[bot] author AND a version-only diff (a changes job lists PR files and sets version_only); adds a least-privilege permissions block. CI-config-only change (two workflow files).

Priority Category Check Status Notes
High Security No hardcoded secrets / credentials ✅ Pass No secrets added; pre-existing PERCY_REGRESSION_TOKEN untouched
High Security Authn/authz checks present N/A Workflow config; permissions is least-privilege (contents:read, pull-requests:read)
High Security Input validation / sanitization ✅ Pass head_ref / pull_request.user.login used only in if:; PR/REPO via env: and quoted in run: — no shell injection; trigger is pull_request, not pull_request_target
High Security No IDOR N/A No resource access
High Security No SQL injection N/A No SQL
High Correctness Logic correct, edge cases handled ✅ Pass Gate verified in all branches (bot version-only release → skip; later source commit → version_only flips → run; human release → run; push/dispatch → run); verified end-to-end on a fork
High Correctness Explicit error handling ✅ Pass changes job fail-safe: gh api error or empty list → version_only=false → full CI
High Correctness No race/concurrency issues N/A None introduced
Medium Testing New code has tests N/A CI config — no unit tests by nature; validated end-to-end on a fork
Medium Testing Error/edge paths tested ✅ Pass Fork run covered skip, run, and fail-safe paths
Medium Testing Existing tests still pass ✅ Pass Only skip-gating added; non-release PRs unchanged
Medium Performance No N+1 / unbounded fetch N/A
Medium Performance Long tasks backgrounded N/A
Medium Quality Follows codebase patterns ✅ Pass Job-level if + permissions block; matches workflow conventions
Medium Quality Focused (single concern) ✅ Pass Only the two workflow files
Low Quality Meaningful names, no dead code ✅ Pass version_only clearly named
Low Quality Comments explain why ✅ Pass One concise comment on the version_only logic
Low Quality No unnecessary deps ✅ Pass Dropped third-party dorny/paths-filter; uses gh (runner built-in)

Findings: No Fail items; no Critical/High findings. Two non-blocking (Low) notes: the changes job is duplicated across test.yml/windows.yml (keep the allow-list regex in lockstep); the regex is intentionally coupled to version-bump.yml's add-paths (fails open to running CI if they diverge).


Verdict: PASS

@AkashBrowserStack AkashBrowserStack merged commit d14a4e8 into master Jun 16, 2026
48 checks passed
@AkashBrowserStack AkashBrowserStack deleted the PER-9560_skip-tests-version-bump-prs branch June 16, 2026 12:55
AkashBrowserStack added a commit that referenced this pull request Jun 17, 2026
…#2293)

* ci: skip heavy suites on version-bump PRs via paths-ignore (PER-9560)

Replaces the job-level skip + version-only gate from #2284 with a much
simpler path filter. Version-bump PRs change only lerna.json +
packages/*/package.json and have no code to test, so test.yml and
windows.yml now skip those PRs entirely via on.pull_request.paths-ignore
— the workflows don't run, so no Build/Test/Regression checks appear on
the PR at all. These checks aren't required, so skipped PRs aren't left
pending. Any PR touching source (or yarn.lock) still runs the full suite;
lint, typecheck, Semgrep and CodeQL are untouched and keep running.

Removes the `changes` job, the version_only / github-actions[bot] gate,
and the permissions block added in #2284.

Verified end-to-end on a fork: a version-only PR triggered only
Lint/Typecheck (Test + Windows did not run); a source PR ran the full suite.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ci: drop explanatory comments from the paths-ignore block (PER-9560)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ninadbstack pushed a commit that referenced this pull request Jun 17, 2026
Restores .github/workflows/test.yml and windows.yml to their pre-PER-9560
state. Removes the paths-ignore filter (added in #2293) — which had already
reverted the job-level skip / changes job / version_only + github-actions[bot]
gate / permissions block from #2284.

Net effect: every workflow change made for PER-9560 this session is undone;
version-bump PRs once again run the full Linux + Windows test suites as before.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧹 maintenance General maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants