44# ⚠️ NOTE - DO NOT COPY THIS FILE
55# instead look at the recommended workflow in the docs
66# ➡️ https://bumpy.varlock.dev/blob/main/docs/github-actions.md ⬅️
7+ #
8+ # This repo splits the check into two mutually-exclusive jobs so it can dogfood its
9+ # OWN unreleased CLI on internal PRs while staying safe for fork PRs. A normal project
10+ # only needs the single `bunx @varlock/bumpy@latest ci check` job (the fork-safe one).
711
812name : Bumpy Check
913
@@ -14,17 +18,41 @@ permissions:
1418 contents : read
1519
1620jobs :
17- bumpy-check :
21+ # Fork PRs (untrusted): run the PUBLISHED bumpy and never execute the PR's code.
22+ # pull_request_target carries a write token + secrets, so building/running fork
23+ # code here would be a privilege-escalation hole. `ci check` reads json/yaml only.
24+ check-published :
25+ if : github.event.pull_request.head.repo.full_name != github.repository
1826 runs-on : ubuntu-latest
1927 steps :
20- # Check out the PR head so bumpy can read the PR's bump files, config, and package.json
28+ # Check out the PR head so bumpy can read the PR's bump files, config, and package.json.
2129 # We never execute this code!
2230 - uses : actions/checkout@v6
2331 with :
2432 ref : ${{ github.event.pull_request.head.sha }}
2533 - uses : oven-sh/setup-bun@v2
26-
27- # reads json/yaml files only, so it's safe to run on fork PRs
2834 - run : bunx @varlock/bumpy@latest ci check
2935 env :
3036 GH_TOKEN : ${{ github.token }}
37+
38+ # Internal (non-fork) PRs: build and run THIS repo's local bumpy so we dogfood the
39+ # unreleased CLI (e.g. channel-aware comments before they're published to @latest).
40+ # ⚠️ DO NOT COPY — only safe because the PR head lives in this same repo, so no
41+ # untrusted code runs with the privileged token. Forks fall through to check-published.
42+ check-local :
43+ if : github.event.pull_request.head.repo.full_name == github.repository
44+ runs-on : ubuntu-latest
45+ steps :
46+ - uses : actions/checkout@v6
47+ with :
48+ ref : ${{ github.event.pull_request.head.sha }}
49+ fetch-depth : 0 # need history to diff bump files against the PR base branch
50+ - uses : oven-sh/setup-bun@v2
51+ - run : bun install
52+ # Build first since we run the local built version of bumpy instead of the published one
53+ - run : bun run --filter @varlock/bumpy build
54+ # run bun install again to make the now-built CLI available
55+ - run : bun install
56+ - run : bunx @varlock/bumpy ci check
57+ env :
58+ GH_TOKEN : ${{ github.token }}
0 commit comments