Skip to content

Feat/refactor ci trigger#5011

Draft
lum1n0us wants to merge 4 commits into
bytecodealliance:mainfrom
lum1n0us:feat/refactor_ci_trigger
Draft

Feat/refactor ci trigger#5011
lum1n0us wants to merge 4 commits into
bytecodealliance:mainfrom
lum1n0us:feat/refactor_ci_trigger

Conversation

@lum1n0us

@lum1n0us lum1n0us commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Move pre-merge CI onto the contributor's fork and spend upstream minutes
only when a maintainer actually approves.

CI over a PR's lifecycle (assume the PR is updated N times = N pushes):

  • Fork (contributor's own minutes): every push to a non-main/release/dev
    branch triggers the push-event CI. Over the PR that is N runs per
    workflow, each still subject to its on.push.paths filter (only the
    workflows whose files changed actually run).
  • Upstream (project minutes): nothing runs on push. A pull_request_review
    (submitted) event fires the gate job; the first APPROVED review of the
    PR lets the real jobs run once, later approvals are skipped. Because a new
    push dismisses the stale approval, each "push -> re-approve" cycle allows
    at most one full upstream run. Best case a clean PR costs upstream exactly
    1 run; a PR re-approved after k re-pushes costs k upstream runs.

Required repository settings:

  • Branch protection: "Dismiss stale pull request approvals when new commits
    are pushed" MUST be enabled. The gate counts APPROVED reviews and skips
    when >1; dismissal is what resets the count so a re-approval can trigger a
    fresh upstream run after new commits.

@lum1n0us
lum1n0us force-pushed the feat/refactor_ci_trigger branch 2 times, most recently from ea909b4 to 7eec92d Compare July 27, 2026 06:35
Move pre-merge CI onto the contributor's fork and spend upstream minutes
only when a maintainer actually approves.

CI over a PR's lifecycle (assume the PR is updated N times = N pushes):

- Fork (contributor's own minutes): every push to a non-main/release/dev
  branch triggers the push-event CI. Over the PR that is N runs per
  workflow, each still subject to its on.push.paths filter (only the
  workflows whose files changed actually run).
- Upstream (project minutes): nothing runs on push. A `pull_request_review`
  (submitted) event fires the `gate` job; the first APPROVED review of the
  PR lets the real jobs run once, later approvals are skipped. Because a new
  push dismisses the stale approval, each "push -> re-approve" cycle allows
  at most one full upstream run. Best case a clean PR costs upstream exactly
  1 run; a PR re-approved after k re-pushes costs k upstream runs.

Required repository settings:

- Branch protection: "Dismiss stale pull request approvals when new commits
  are pushed" MUST be enabled. The gate counts APPROVED reviews and skips
  when >1; dismissal is what resets the count so a re-approval can trigger a
  fresh upstream run after new commits.
- Actions must be allowed to run on forks (default), so fork push CI works.

Implementation:

- Fork CI: replace `pull_request` triggers with unrestricted `push`
  (branches-ignore main/release/**/dev/**) so forks run on their own minutes.
- Upstream CI: add `pull_request_review` (submitted) plus a reusable
  `gate` job (.github/workflows/gate.yml) that only lets CI run for the
  first approval of a PR.
- Gate restores the path filtering `pull_request_review` lacks via
  .github/scripts/pr_touches_paths.py.
- Checkout steps pin the PR merge ref (env.PR_REF) under pull_request_review,
  since the event otherwise checks out the base branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lum1n0us
lum1n0us force-pushed the feat/refactor_ci_trigger branch from 7eec92d to 431e9f4 Compare July 27, 2026 07:10
@lum1n0us
lum1n0us force-pushed the feat/refactor_ci_trigger branch from ce2a11b to eee08b7 Compare July 27, 2026 07:32
@lum1n0us
lum1n0us force-pushed the feat/refactor_ci_trigger branch from 191cda7 to 9af5dc0 Compare July 27, 2026 12:14
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.

1 participant