Skip to content

Commit e6097b9

Browse files
authored
fix: start CI on sync PRs when a person marks them ready (#27)
Assisted-by: Claude Opus 5.5 (1M context)
1 parent ca21c33 commit e6097b9

3 files changed

Lines changed: 16 additions & 25 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
# upstream-sync.yml dispatches this on its branch: pushes made with
8-
# GITHUB_TOKEN start no push/pull_request runs.
9-
workflow_dispatch:
7+
# ready_for_review: upstream-sync PRs open as drafts, and a person marking
8+
# one ready is what starts CI on it (runs the workflow token starts don't
9+
# count as checks on a pull request).
10+
types: [opened, synchronize, reopened, ready_for_review]
1011

1112
# Read-only, and checkouts don't keep the token: no job here pushes.
1213
permissions:

‎.github/workflows/upstream-sync.yml‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ jobs:
3030
issues: write # the fallback issue when the branch can't be pushed or the PR opened
3131
env:
3232
BUN_VERSION: 1.4.3 # bun.lock needs Bun 1.4+; same pin as azure-pipelines/
33-
outputs:
34-
dispatch-ci: ${{ steps.sync.outputs.dispatch-ci }}
3533
steps:
3634
# From npm rather than a third-party action, and before checkout, so
3735
# nothing but first-party code runs while the write token is around.
@@ -44,25 +42,9 @@ jobs:
4442
# The CLI is the version bun.lock pins (integrity-checked), so it only
4543
# changes when a sync PR is merged.
4644
- run: bun install --frozen-lockfile --ignore-scripts
47-
- id: sync
48-
run: ./node_modules/.bin/interbox workspace sync --platform github --into "$DEFAULT_BRANCH"
45+
- run: ./node_modules/.bin/interbox workspace sync --platform github --into "$DEFAULT_BRANCH"
4946
env:
5047
# A schedule event has no repository payload; it always runs on the default branch.
5148
DEFAULT_BRANCH: ${{ github.event.repository.default_branch || github.ref_name }}
5249
GH_TOKEN: ${{ github.token }}
5350
INTERBOX_UPSTREAM_URL: ${{ vars.INTERBOX_UPSTREAM_URL }}
54-
55-
# Pushes made with GITHUB_TOKEN start no workflow runs, so CI on the sync
56-
# branch is dispatched here, from a job that holds nothing else.
57-
dispatch-ci:
58-
needs: sync
59-
# !cancelled(): the CLI writes dispatch-ci even when it fails after pushing.
60-
if: ${{ !cancelled() && needs.sync.outputs.dispatch-ci == 'true' }}
61-
runs-on: ubuntu-latest
62-
timeout-minutes: 5
63-
permissions:
64-
actions: write
65-
steps:
66-
- run: gh workflow run ci.yml --ref upstream-sync --repo "$GITHUB_REPOSITORY"
67-
env:
68-
GH_TOKEN: ${{ github.token }}

‎README.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ dependencies and its own suite; see its README.
171171

172172
In a copy of this repo, a daily job keeps one PR open from the `upstream-sync`
173173
branch that brings `main` up to the latest upstream release. Set the variable
174-
`INTERBOX_UPSTREAM_SYNC=off` to stop it. If the PR
175-
includes a release with breaking changes, it opens as a draft labelled
176-
`breaking-change`, with the upgrade notes in its description.
174+
`INTERBOX_UPSTREAM_SYNC=off` to stop it. When the PR includes a release with
175+
breaking changes, it is labelled `breaking-change` and lists the upgrade notes
176+
in its description.
177177

178178
A release that changes CI definitions for the job's own platform, such as
179179
`.github/workflows/` on GitHub or `azure-pipelines/` on Azure, is never pushed
@@ -206,6 +206,12 @@ the pipeline can only rebuild a branch it created.
206206
require the `test` and `simulator` checks, block force pushes and deletion,
207207
and give GitHub Actions no bypass.
208208

209+
The PR opens as a draft, and CI starts when you mark it ready for review.
210+
GitHub doesn't count checks from runs that the workflow token starts, so this
211+
is the run your required checks wait for. When the job pushes a newer release
212+
to the branch, the PR goes back to draft. In a repo without draft PRs it opens
213+
ready instead; close and reopen it to start CI.
214+
209215
Optional repository variables: `INTERBOX_UPSTREAM_SYNC=off` turns the job off,
210216
and `INTERBOX_UPSTREAM_URL` points it at another upstream.
211217

@@ -231,5 +237,7 @@ and `INTERBOX_UPSTREAM_URL` points it at another upstream.
231237
requestors can't approve their own changes, the most recent pusher can't
232238
approve, and votes reset on new pushes.
233239

240+
Here a release with breaking changes opens as a draft PR.
241+
234242
The same two variables work as pipeline variables. Define them as not settable
235243
at queue time.

0 commit comments

Comments
 (0)