Skip to content

ci(repo): gate PR tests behind dispatch, label, or changeset#199

Merged
designcode merged 1 commit into
mainfrom
ci/conditional-tests
Jul 20, 2026
Merged

ci(repo): gate PR tests behind dispatch, label, or changeset#199
designcode merged 1 commit into
mainfrom
ci/conditional-tests

Conversation

@designcode

@designcode designcode commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What

Makes the integration test suite in pr.yaml conditional so it doesn't run on every PR push, keeping the pipeline short when the full suite isn't needed.

The test suite now runs when any of these is true:

  1. the workflow is dispatched manually (workflow_dispatch),
  2. the PR carries a test label, or
  3. the PR adds a changeset (something is shipping to npm).

Otherwise it's skipped. The cheap checks (lint / build / publint) still gate every PR, and the checks job always reports its status, so branch protection is unaffected.

Also

  • workflow_dispatch trigger + a concurrency group that cancels superseded runs on the same PR/branch.
  • The fork merge/rebase integration suite is now skipped by default (it creates buckets, forks, and waits out eventual consistency, adding noticeable time to the pipeline). Opt in with RUN_FORK_INTEGRATION_TESTS=true, via a new shouldSkipForkTests() helper in packages/storage/src/test/setup.ts.

Notes / follow-ups

  • Requires a test label to exist in the repo (create it in repo Settings → Labels, or gh label create test).
  • Fork PRs don't receive secrets.*, so a test-labeled fork PR would fail the test step — pre-existing behavior, flagged for awareness. Can add a same-repo guard if we take external PRs.
  • release.yaml still runs the full suite on merge to main, so nothing ships untested.
  • No changeset added (test/CI-only change, per request).

Test

  • Confirmed the fork suite skips with no flag set: 1 skipped (1), 6 skipped (6), zero network calls.
  • biome check clean.

🤖 Generated with Claude Code


Note

Medium Risk
CI gating reduces how often integration tests run on PRs and excludes fork tests by default even when tests execute, which shifts reliance to manual/test/changeset triggers and release workflow unless RUN_FORK_INTEGRATION_TESTS is set elsewhere.

Overview
PR workflow no longer runs the integration test step on every push. Lint, build, and publint still run on every PR. Run tests only when the workflow is manually dispatched, the PR has a test label (including re-runs on labeled), or the branch includes a changeset .md under .changeset/. A gate step records the decision in the job summary; the test step is conditional so skipped runs still leave the checks job green for branch protection.

Also adds workflow_dispatch, concurrency with cancel-in-progress for superseded runs, and a job if so unrelated label events do not re-run the whole job.

Storage tests: fork merge/rebase integration now uses shouldSkipForkTests(), which skips unless RUN_FORK_INTEGRATION_TESTS=true (in addition to the usual Tigris env vars). When PR tests do run, that suite stays off by default to shorten the pipeline.

Reviewed by Cursor Bugbot for commit c98d2ff. Bugbot is set up for automated code reviews on this repo. Configure here.

Run the integration test suite in pr.yaml only when the run is
dispatched manually, the PR carries a `test` label, or the PR adds a
changeset; otherwise skip it while lint/build/publint still gate every
PR. This keeps the pipeline short on PRs that don't need the full suite.
Add workflow_dispatch and a concurrency group that cancels superseded
runs.

Also skip the fork merge/rebase integration suite by default (it creates
buckets, forks, and waits out consistency, which adds noticeable time to
the pipeline), gated behind RUN_FORK_INTEGRATION_TESTS=true via a new
shouldSkipForkTests() helper.

Assisted-by: Opus 4.8 via Claude Code
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes integration testing conditional and adds a separate opt-in for fork tests. The main changes are:

  • Runs PR tests after manual dispatch, a test label, or a changeset.
  • Cancels superseded workflow runs for each PR or branch.
  • Skips fork merge and rebase tests unless explicitly enabled.

Confidence Score: 4/5

Manual runs can test the wrong ref, and automated workflows no longer exercise fork integration paths.

  • Manual dispatch can produce a green result for default branch instead of selected branch.
  • PR and release workflows omit the new fork-test opt-in variable.
  • Label gating, changeset detection, and changed TypeScript import are otherwise consistent.

.github/workflows/pr.yaml and packages/storage/src/test/setup.ts

Important Files Changed

Filename Overview
.github/workflows/pr.yaml Adds workflow triggers, concurrency, and test gating, but manual dispatch can test default branch instead of selected ref.
packages/storage/src/test/fork-merge-rebase.integration.test.ts Switches both fork integration suites to new skip helper with a compatible import and call.
packages/storage/src/test/setup.ts Adds explicit fork-test opt-in, but no automated workflow enables it.

Reviews (1): Last reviewed commit: "ci(repo): gate PR tests behind dispatch,..." | Re-trigger Greptile

Comment thread .github/workflows/pr.yaml
Comment thread packages/storage/src/test/setup.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c98d2ff. Configure here.

Comment thread .github/workflows/pr.yaml
Comment thread packages/storage/src/test/setup.ts
Comment thread packages/storage/src/test/setup.ts
@designcode
designcode merged commit a3c6d44 into main Jul 20, 2026
3 checks passed
@designcode
designcode deleted the ci/conditional-tests branch July 20, 2026 11:24
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.

2 participants