Repository navigation
96 lines (87 loc) · 4.16 KB
/
Copy pathversion-packages.yml
File metadata and controls
96 lines (87 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Keeps the rolling changesets "Version Packages" PR open against `v2/main`
# (#4472). It runs on every push there: when `.changeset/` holds pending
# changesets it runs `npm run version-packages` (`changeset version`, then a
# lockfile refresh, since the lockfile records each workspace's version) and
# creates or updates one PR carrying the version bumps and the CHANGELOG
# entries. With no pending changesets it does nothing.
#
# It targets `v2/main`, not `main`: the bump is part of the milestone's work,
# so it has to exist on the develop branch before the milestone merge carries
# it to `main`. A bump made downstream of `v2/main` would never flow back.
#
# The action rewrites the PR's title and body on every run, so that PR cannot
# carry a `Closes #N` line the way every other PR here does; `AGENTS.md` names
# it as an exception and says how it is tied to its release issue instead. The
# `v2` label does survive an update, and this workflow applies it.
#
# The action pushes the PR's branch with the workflow token, and a push made
# with that token starts no workflow, so the PR would get no TypeScript or
# Python CI (#5110). Closing and reopening it does not help either: that fires
# `pull_request`, and those workflows run on `push`. So after each update this
# workflow dispatches both on the PR's branch; `workflow_dispatch` is the one
# event the workflow token can start. The `pull_request` workflows, DCO and the
# Everything diff, get no run from that token's events either (GitHub holds
# them as `action_required`, #5173), so they are dispatched the same way.
#
# This workflow only ever opens a PR. It gives the action no publish script, so
# it never publishes, tags or creates a Release; that is `release.yml`, on a
# maintainer-published GitHub Release.
name: Version Packages
on:
push:
branches: [v2/main]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
version:
timeout-minutes: 10
if: github.repository_owner == 'modelcontextprotocol'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# To dispatch the CI, DCO and Everything diff workflows on the PR's branch.
actions: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
# Versioning needs the changesets CLI, not a build, so the workspaces'
# `prepare` scripts are skipped.
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Create or update the Version Packages PR
id: changesets
uses: changesets/action@v2
with:
version-script: npm run version-packages
pr-title: "chore: version packages"
commit-message: "chore: version packages"
env:
# Read by @changesets/changelog-github to link PRs and authors in
# the CHANGELOG entries. The action itself authenticates through its
# `github-token` input, which defaults to this same token.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Every PR in this repository is labeled `v2`. Adding a label that is
# already there is a no-op, so this runs on every update.
- name: Label the Version Packages PR
if: steps.changesets.outputs.pr-number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ steps.changesets.outputs.pr-number }}
run: gh pr edit "$PR" --add-label v2
# The action pushed the branch with the workflow token, which starts no
# workflow, so CI is dispatched on it explicitly (see the header). A
# dispatch on every update matches a push run on every push: the CI
# workflows' concurrency groups cancel the superseded run.
- name: Run CI on the Version Packages PR
if: steps.changesets.outputs.pr-number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ steps.changesets.outputs.pr-number }}
run: |
BRANCH=$(gh pr view "$PR" --json headRefName --jq .headRefName)
for workflow in typescript.yml python.yml dco.yml everything-mcp-diff.yml; do
gh workflow run "$workflow" --ref "$BRANCH"
done