Skip to content

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

Open
AkashBrowserStack wants to merge 4 commits into
masterfrom
PER-9560_skip-tests-version-bump-prs
Open

ci: skip heavy test suites on bot version-bump PRs (PER-9560)#2284
AkashBrowserStack wants to merge 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>
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.

2 participants