Skip to content

Commit 573780a

Browse files
committed
ci: dogfood local bumpy in the check workflow for internal PRs
Split the PR check into two mutually-exclusive jobs: - check-published: fork PRs run published @latest (never executes untrusted code with the pull_request_target write token) - check-local: non-fork PRs build + run this repo's local bumpy, so unreleased behavior (e.g. channel-aware comments) is dogfooded on our own PRs before it ships to @latest Lets PR #104 (internal, targets the next channel) show the real channel-aware check comment now instead of waiting for promotion.
1 parent 6ca52ea commit 573780a

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

.github/workflows/bumpy-check.yaml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
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

812
name: Bumpy Check
913

@@ -14,17 +18,41 @@ permissions:
1418
contents: read
1519

1620
jobs:
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

Comments
 (0)