Skip to content

ci: gate PR CI on a run-ci label and an approval for external authors - #397

Merged
Rockdu merged 1 commit into
mainfrom
rockdu/ci-gate-author-role
Nov 18, 2026
Merged

Rockdu merged 1 commit into
mainfrom
rockdu/ci-gate-author-role

Conversation

@Rockdu

@Rockdu Rockdu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

What

  • ci-gate authorizes a PR run with one rule: the PR carries a run-ci-* label, and either its author has write access to the repository or a reviewer with write access has approved the PR. The approval is PR-wide, as in radixark/miles: it covers later pushes too.
  • The pull_request_review trigger is removed. Reviews never start or rerun a suite; a label (or a re-run of the red ci-gate run after approving) does.
  • The gate reads the PR through pulls.get, so a re-run evaluates the current labels and reviews rather than the event payload. Roles come from repos.getCollaboratorPermissionLevel().permission (write / admin; maintain and custom roles fold into their base permission).

Why

The old gate authorized every PR on approval || label and the workflow also fired on pull_request_review, so any review (approve, comment, dismiss) on any PR re-ran the whole GPU suite on an already-green head (observed on #384 and #392). A label alone was also a full authorization regardless of who the author was.

Validation

  • yaml.safe_load on both workflows; the gate script extracted and run through node --check; pre-commit (check-yaml) clean.
  • The extracted gate script run against 17 mocked scenarios (write/admin author with and without label, outside author with approval by write / read / dismissed / changes-requested / deleted reviewers, comment-only reviews, bot author, docs-only PR, stale payload vs live PR, unknown login): every case yields the expected authorized output and failure message. Harness kept outside the repo.
  • This PR itself exercises the write-author + label path (run-ci-basic). The outside-author path can only be exercised by a PR from a read-role account after merge.
  • Not in this PR (pre-existing): bot-slash-lint.yaml runs the PR head's pre-commit hooks for any commenter with a write token; the gate lives in workflow files taken from the PR merge ref and the fork-approval policy exempts org members; PR-body ci-sglang-* lines are honoured for every authorized PR.

Files

  • .github/workflows/pr-test.yml — on: without pull_request_review; ci-gate rewritten; three checkout ref: expressions drop the review-event branch.
  • .github/workflows/_run-ci.yml — two checkout ref: expressions drop the review-event branch.

Checklist

  • pre-commit run --all-files passes (check-yaml on the touched files; no Python touched)
  • Added/updated tests for new behaviour — no test harness for workflow scripts in this repo; scenario harness run locally, see Validation
  • pytest -x is green — not applicable, no Python changed
  • If launch flags changed, python3 train.py --help still parses — not applicable
  • If a public flag was added, it appears in the CLI reference docs — not applicable
  • If an example was added, it has a real walkthrough — not applicable

@Rockdu Rockdu added the run-ci-basic Authorize and run only basic unlabeled CI tests label Nov 18, 2026
@Rockdu
Rockdu marked this pull request as ready for review November 18, 2026 07:01
@Rockdu Rockdu changed the title ci: gate PR CI on a run-ci label and an approval for outside authors ci: gate PR CI on a run-ci label and an approval for external authors Nov 18, 2026
@Rockdu
Rockdu merged commit e92a6f5 into main Nov 18, 2026
25 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci-basic Authorize and run only basic unlabeled CI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant