Skip to content

Commit 2ffe79f

Browse files
cliffhallclaude
andcommitted
ci: dispatch CI on the version PRs that automation opens
The Version Packages and Prepare Python Release workflows push their PR branches with the workflow token, which starts no workflow, and since modelcontextprotocol#5048 the TypeScript and Python workflows run on push only, so a close and reopen (which fires pull_request) never started them either. Both CI workflows now also accept workflow_dispatch, the one event that token can start, and both version workflows dispatch them on the PR's branch after opening or updating it. RELEASING.md and the release skill describe that path instead of close-and-reopen. Closes modelcontextprotocol#5110 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 7f4922b commit 2ffe79f

6 files changed

Lines changed: 64 additions & 6 deletions

File tree

‎.claude/skills/release/SKILL.md‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,14 @@ Then, on the PR:
177177
1. **Tie it to the release issue with a comment**, `Part of #N`. The action
178178
rewrites the PR's body on every push to `v2/main`, so a `Closes` line there
179179
would not survive; this is the exception `AGENTS.md` names.
180-
2. **Close and reopen it to start CI.** A PR opened with the workflow token
181-
does not trigger workflows.
180+
2. **Wait for its CI to pass.** The workflow token's push starts no workflow,
181+
so the Version Packages workflow dispatches the TypeScript and Python
182+
workflows on `changeset-release/v2/main` after each update; their checks
183+
report on the PR's head commit. Closing and reopening the PR does not start
184+
them (that fires `pull_request`; they run on `push`). If none appear, run
185+
them by hand:
186+
`gh workflow run typescript.yml --ref changeset-release/v2/main` (and
187+
`python.yml`).
182188
3. **Read it**: each bump matches the semver policy in `RELEASING.md`, each
183189
`CHANGELOG.md` entry says what a user of the server needs to know, the
184190
consumed changeset files are deleted, and `package-lock.json` records the
@@ -195,8 +201,10 @@ gh workflow run prepare-python-release.yml --repo modelcontextprotocol/servers \
195201
```
196202

197203
It opens a PR that starts with `Closes #N`, on a branch named
198-
`v2/chore/<N>-python-calver-<date>`, labeled `v2`. Close and reopen it to start
199-
CI, check that each stamped package really changed, and a maintainer merges it.
204+
`v2/chore/<N>-python-calver-<date>`, labeled `v2`, and dispatches the
205+
TypeScript and Python workflows on that branch, as the Version Packages
206+
workflow does. Wait for that CI to pass, check that each stamped package really
207+
changed, and a maintainer merges it.
200208
No PR means no Python server has a shipped change since its last stamp.
201209

202210
⚠️ GitHub only dispatches a workflow that exists on the default branch. Until

‎.github/workflows/prepare-python-release.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
# milestone's release issue (the `issue` input), its branch is named for that
1414
# issue, and it is labeled `v2`. The link is only a cross-reference on
1515
# `v2/main`; the release issue stays open until the Release is published.
16+
#
17+
# It pushes the branch with the workflow token, and a push made with that
18+
# token starts no workflow, so the PR would get no TypeScript or Python CI
19+
# (#5110); a close and reopen fires only `pull_request`, which those workflows
20+
# do not run on. So it dispatches both on the branch once the PR is open:
21+
# `workflow_dispatch` is the one event the workflow token can start.
1622

1723
name: Prepare Python Release
1824

@@ -32,6 +38,8 @@ jobs:
3238
permissions:
3339
contents: write
3440
pull-requests: write
41+
# To dispatch the TypeScript and Python workflows on the PR's branch.
42+
actions: write
3543
steps:
3644
# The ref this was dispatched on becomes the PR's base, and every PR
3745
# targets `v2/main`. A run from `main` would open a version PR straight
@@ -100,7 +108,7 @@ jobs:
100108
echo "Generated by the **Prepare Python Release** workflow. Nothing is published until a maintainer publishes a GitHub Release."
101109
echo
102110
echo "> [!NOTE]"
103-
echo "> A PR opened with the workflow token does not trigger CI. Close and reopen this PR to run it."
111+
echo "> A push made with the workflow token starts no CI, so the workflow dispatched the TypeScript and Python workflows on this branch. Their checks report on the head commit. To run them again: \`gh workflow run python.yml --ref $BRANCH\` (and \`typescript.yml\`)."
104112
} > "$RUNNER_TEMP/pr-body.md"
105113
# A second run on the same day force-updates the branch, and may
106114
# stamp a different set of packages; the open PR's body is rewritten
@@ -117,3 +125,9 @@ jobs:
117125
--title "chore: stamp Python CalVer versions for $DATE" \
118126
--body-file "$RUNNER_TEMP/pr-body.md"
119127
fi
128+
# The push above starts no workflow (see the header), so CI is
129+
# dispatched on the branch explicitly, after a first run and a rerun
130+
# alike.
131+
for workflow in typescript.yml python.yml; do
132+
gh workflow run "$workflow" --ref "$BRANCH"
133+
done

‎.github/workflows/python.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
# PR branch ran each workflow twice (once per event). PR checks still report
66
# from the push run of the head commit.
77
push:
8+
# A push made with the workflow token starts no workflow, so the version PRs
9+
# that automation opens (Version Packages, Prepare Python Release) get no
10+
# push run. Their workflows dispatch this one on the PR's branch instead
11+
# (#5110): `workflow_dispatch` is the one event that token can start, and its
12+
# run reports its checks on the branch's head commit, which the PR shows.
13+
workflow_dispatch:
814

915
# Superseded runs on the same ref are cancelled (e.g. rapid amend-pushes),
1016
# except on main, where every merge keeps its own CI run

‎.github/workflows/typescript.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
# PR branch ran each workflow twice (once per event). PR checks still report
66
# from the push run of the head commit.
77
push:
8+
# A push made with the workflow token starts no workflow, so the version PRs
9+
# that automation opens (Version Packages, Prepare Python Release) get no
10+
# push run. Their workflows dispatch this one on the PR's branch instead
11+
# (#5110): `workflow_dispatch` is the one event that token can start, and its
12+
# run reports its checks on the branch's head commit, which the PR shows.
13+
workflow_dispatch:
814

915
# Superseded runs on the same ref are cancelled (e.g. rapid amend-pushes),
1016
# except on main, where every merge keeps its own CI run

‎.github/workflows/version-packages.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
# it as an exception and says how it is tied to its release issue instead. The
1515
# `v2` label does survive an update, and this workflow applies it.
1616
#
17+
# The action pushes the PR's branch with the workflow token, and a push made
18+
# with that token starts no workflow, so the PR would get no TypeScript or
19+
# Python CI (#5110). Closing and reopening it does not help either: that fires
20+
# `pull_request`, and those workflows run on `push`. So after each update this
21+
# workflow dispatches both on the PR's branch; `workflow_dispatch` is the one
22+
# event the workflow token can start.
23+
#
1724
# This workflow only ever opens a PR. It gives the action no publish script, so
1825
# it never publishes, tags or creates a Release; that is `release.yml`, on a
1926
# maintainer-published GitHub Release.
@@ -34,6 +41,8 @@ jobs:
3441
permissions:
3542
contents: write
3643
pull-requests: write
44+
# To dispatch the TypeScript and Python workflows on the PR's branch.
45+
actions: write
3746
steps:
3847
- uses: actions/checkout@v6
3948

@@ -68,3 +77,18 @@ jobs:
6877
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6978
PR: ${{ steps.changesets.outputs.pr-number }}
7079
run: gh pr edit "$PR" --add-label v2
80+
81+
# The action pushed the branch with the workflow token, which starts no
82+
# workflow, so CI is dispatched on it explicitly (see the header). A
83+
# dispatch on every update matches a push run on every push: the CI
84+
# workflows' concurrency groups cancel the superseded run.
85+
- name: Run CI on the Version Packages PR
86+
if: steps.changesets.outputs.pr-number != ''
87+
env:
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
PR: ${{ steps.changesets.outputs.pr-number }}
90+
run: |
91+
BRANCH=$(gh pr view "$PR" --json headRefName --jq .headRefName)
92+
for workflow in typescript.yml python.yml; do
93+
gh workflow run "$workflow" --ref "$BRANCH"
94+
done

‎RELEASING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ node scripts/prepare-python-release.mjs # prints one "name: old -> new" line
3939
### PRs opened by these workflows
4040

4141
> [!NOTE]
42-
> Both workflows open their PR with the workflow token, and GitHub does not start CI for a PR opened that way. Close and reopen the PR to run CI before merging. The Version Packages PR's body is rewritten on every push to `v2/main`, so it is tied to the release issue by a comment (`Part of #N`) instead of a body line. The repository setting **Settings → Actions → General → Allow GitHub Actions to create and approve pull requests** must be on, or the workflows fail at the step that opens the PR.
42+
> Both workflows push their PR's branch with the workflow token, and a push made with that token starts no workflow, so each one then dispatches the TypeScript and Python workflows on that branch (`workflow_dispatch` is the one event the token can start). Their checks report on the PR's head commit; wait for them to pass before merging. Closing and reopening the PR does not start them: that fires `pull_request`, and those workflows run on `push`. To run them again by hand: `gh workflow run typescript.yml --ref <branch>` (and `python.yml`). The Version Packages PR's body is rewritten on every push to `v2/main`, so it is tied to the release issue by a comment (`Part of #N`) instead of a body line. The repository setting **Settings → Actions → General → Allow GitHub Actions to create and approve pull requests** must be on, or the workflows fail at the step that opens the PR.
4343
4444
## How publishing works
4545

0 commit comments

Comments
 (0)