From c7557802abd80a6e2434fc0fea413f8128c2f8c9 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Fri, 12 Jun 2026 15:41:41 -0700 Subject: [PATCH] ci: bring dogfood check workflow split to main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pull_request_target runs the workflow file from the default branch, so the check-local/check-published split that landed on next (72c8ed1) never executes — PRs targeting next still get checked by published bumpy via main's old workflow, producing stale stable-flow comments. Identical content to next's copy, so promotion merges clean. --- .github/workflows/bumpy-check.yaml | 36 ++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bumpy-check.yaml b/.github/workflows/bumpy-check.yaml index b332ecf..c3b0a15 100644 --- a/.github/workflows/bumpy-check.yaml +++ b/.github/workflows/bumpy-check.yaml @@ -4,6 +4,10 @@ # ⚠️ NOTE - DO NOT COPY THIS FILE # instead look at the recommended workflow in the docs # ➡️ https://bumpy.varlock.dev/blob/main/docs/github-actions.md ⬅️ +# +# This repo splits the check into two mutually-exclusive jobs so it can dogfood its +# OWN unreleased CLI on internal PRs while staying safe for fork PRs. A normal project +# only needs the single `bunx @varlock/bumpy@latest ci check` job (the fork-safe one). name: Bumpy Check @@ -14,17 +18,41 @@ permissions: contents: read jobs: - bumpy-check: + # Fork PRs (untrusted): run the PUBLISHED bumpy and never execute the PR's code. + # pull_request_target carries a write token + secrets, so building/running fork + # code here would be a privilege-escalation hole. `ci check` reads json/yaml only. + check-published: + if: github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - # Check out the PR head so bumpy can read the PR's bump files, config, and package.json + # Check out the PR head so bumpy can read the PR's bump files, config, and package.json. # We never execute this code! - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} - uses: oven-sh/setup-bun@v2 - - # reads json/yaml files only, so it's safe to run on fork PRs - run: bunx @varlock/bumpy@latest ci check env: GH_TOKEN: ${{ github.token }} + + # Internal (non-fork) PRs: build and run THIS repo's local bumpy so we dogfood the + # unreleased CLI (e.g. channel-aware comments before they're published to @latest). + # ⚠️ DO NOT COPY — only safe because the PR head lives in this same repo, so no + # untrusted code runs with the privileged token. Forks fall through to check-published. + check-local: + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 # need history to diff bump files against the PR base branch + - uses: oven-sh/setup-bun@v2 + - run: bun install + # Build first since we run the local built version of bumpy instead of the published one + - run: bun run --filter @varlock/bumpy build + # run bun install again to make the now-built CLI available + - run: bun install + - run: bunx @varlock/bumpy ci check + env: + GH_TOKEN: ${{ github.token }}