Skip to content

ci: gate ray-update PRs on green buildkite/template-test#642

Open
Aydin-ab wants to merge 7 commits intomainfrom
ci/require-template-test-on-ray-update
Open

ci: gate ray-update PRs on green buildkite/template-test#642
Aydin-ab wants to merge 7 commits intomainfrom
ci/require-template-test-on-ray-update

Conversation

@Aydin-ab
Copy link
Copy Markdown
Contributor

@Aydin-ab Aydin-ab commented May 4, 2026

Summary

New workflow `ray-update-requires-template-test`: fails when a PR carries the `ray-update` label but its head commit lacks a green `buildkite/template-test` status. PRs without the label always pass.

Why

Today, a `ray-update` PR can technically merge without ever running `/test-template` — the `/template` skill mandates it but only the agent flow enforces it. This workflow adds a hard gate so a green Buildkite build is required for any PR labeled `ray-update` (human-opened or otherwise).

How

  • Triggers on `pull_request` (opened/synchronize/reopened/labeled/unlabeled) AND on `status` events.
  • The `status` trigger handles auto-rerun: when Buildkite posts the green status back, GitHub fires `status`, the workflow re-runs, the gate flips green automatically — no manual rerun needed.
  • If the label is absent, exits 0 (passes).

Required follow-up to actually enforce

This PR adds the workflow but doesn't enforce it. Once merged, an admin needs to add the workflow's check (`ray-update-requires-template-test / check`) to `main` branch protection → Required status checks. Without that step, the workflow runs but doesn't block merges.

Test plan

  • CI green on this PR (workflow runs, sees no `ray-update` label, passes).
  • Smoke test by opening a throwaway PR with the `ray-update` label and verifying the workflow fails until `/test-template` succeeds.

Aydin-ab and others added 2 commits May 4, 2026 14:42
New workflow that fails when a PR carries the ray-update label without a
passing buildkite/template-test commit-status on its head SHA. PRs
without the label always pass. Triggers on pull_request changes and on
status events so it re-evaluates automatically when the Buildkite build
result lands — no manual rerun needed.

To activate enforcement, add this workflow's check
(ray-update-requires-template-test / check) to the main branch
protection's required status checks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the single 'needs a green build' error with a case that names
each failure mode distinctly: 'missing' (never ran) vs 'pending' vs
'failure'/'error' vs unexpected. Each suggests the right next action.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub Actions workflow to enforce the repo’s existing template-validation process for ray-update PRs by requiring a green buildkite/template-test status before merge. This fits the codebase’s template automation flow, where /test-template is the mechanism that triggers template CI.

Changes:

  • Adds ray-update-requires-template-test workflow triggered on pull_request and status.
  • Resolves the PR/head SHA, checks for the ray-update label, and inspects the latest buildkite/template-test commit status.
  • Emits actionable failure messages for missing, pending, failed, or unexpected statuses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ray-update-requires-template-test.yaml Outdated
Comment thread .github/workflows/ray-update-requires-template-test.yaml Outdated
Aydin-ab and others added 2 commits May 4, 2026 16:26
Two edge cases the previous logic mishandled:

1. status events can return multiple PRs sharing a commit (stacked PRs,
   backports). Picking [0] silently missed the ray-update PR if a
   non-ray-update PR happened to come first. Now iterate all PRs that
   contain the commit.

2. Stale SHA: status events arrive for a specific commit; if a newer
   commit was pushed in the meantime, gating on the event's SHA could
   report 'green' based on an outdated commit's status. Always re-fetch
   the PR's current head (headRefOid) via the API and gate on that.

Also: on status events, only gate PRs whose current head matches the
status's SHA — the check-run we produce is attached to that commit, so
only those PRs see it via branch protection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ray-update-requires-template-test.yaml Outdated
Aydin-ab and others added 3 commits May 4, 2026 19:27
…pdate

Per the review: if a fork PR is labeled ray-update, this gate would
block forever — /test-template (in .github/workflows/test-template.yaml)
explicitly refuses cross-repo PRs for security, so buildkite/template-test
can never appear, so the gate stays red with no useful explanation.

Add isCrossRepository to the PR query and emit a fork-specific error
that names the actual constraint and points at the workaround (mirror
to an internal branch). Same outcome (the PR can't merge), but the
failure mode is now discoverable instead of silently confusing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No semantic change. Cuts the verbose multi-line comment blocks down to
single-line whys, collapses the per-PR HEAD/labels/fork echos onto one
line, and shortens the case-arm error messages while keeping each
distinguishable. 125 → 88 lines.

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

Quick context for anyone applying the label — the new gate workflow added in this PR enforces it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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