Skip to content

Commit 7e4384d

Browse files
authored
CHANGELOG.md is the release's: notes live in PR descriptions, and CI ignores the file (#2697)
* Read a pull request's release note from its description * CI ignores CHANGELOG.md, and a pull request's release note lives in its description CHANGELOG.md is left out of every decision of scripts/ci-changes.ts, and a merge group that changes nothing else runs nothing. A new release note check, part of verify, refuses a pull request that changes CHANGELOG.md (other than the release's own), has no note under ## Changelog, or deprecates part of the API without naming it there. Editing the description re-runs it. * Give the release note check a budget and the stop mark every CI job leaves * The release writes CHANGELOG.md from its pull requests' notes Create release PR reads the note under ## Changelog in the description of every pull request merged since the previous stable release, merges them by heading with Before upgrading first, and writes the section. Lines still under Unreleased come first, pull requests merged before this flow need no note there, and the release's own pull requests are skipped. A missing or unreadable note stops the run naming the pull request, and so does a deprecation the changelog would not list. A candidate writes its notes under Unreleased; a later candidate or the final reads what was there from the commit the first candidate was cut from. Tested against the real 1.2.6 release. * Skip the prose nothing reads, in pull requests, merge groups and the signing workflows Docs were already skipped on pull requests unless a test named them. Now: a test's fixture and docs/cosign.pub are code whatever their names, the phone app's AGENTS.md no longer runs its type check, a merge group of docs runs only the tests that name them, and Markdown no longer starts the Desktop and signing workflows. Each kind was checked against every test, script, build, lint and workflow, and the rule is tested against this tree's files. * Give the release note the stop step's permission, and the release's call of CI the read it asks for
1 parent 937ba4f commit 7e4384d

28 files changed

Lines changed: 2406 additions & 149 deletions

‎.github/ci-budgets.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"build": 3,
3333
"component list": 1,
3434
"component dockerfile (*)": 10,
35+
"release note": 1,
3536
"verify": 1
3637
}
3738
},

‎.github/pull_request_template.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@ conditional update, `LISTEN`/`NOTIFY` for fan-out.
4242

4343
## Changelog
4444

45-
- [ ] A line in `CHANGELOG.md` under `Unreleased`, or a sentence on why a deployment behaves no
46-
differently afterwards.
45+
<!--
46+
The release note. The release copies it into CHANGELOG.md; never edit CHANGELOG.md yourself, CI
47+
refuses a pull request that does. Write it for the person running OpenBot, deciding whether to
48+
upgrade: what a deployment does differently afterwards. Put each line under a bold heading on a line
49+
of its own, the way CHANGELOG.md does (**Before upgrading.**, **API.**, **OpenBot Desktop.**, or a
50+
heading of your own), and name anything you deprecate in backticks with its sunset under
51+
**Before upgrading.** Write none instead when nobody running OpenBot would notice.
52+
53+
**API.**
54+
55+
- **Added: what it is.** What a deployment does differently, and what to do about it.
56+
-->
4757

4858
## Proof
4959

‎.github/workflows/ci.yml‎

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656
# merge queue merged skips the checks the queue's run already passed on that same commit, and runs
5757
# only `component dockerfile` and any job whose cache key the push changed, which write the caches
5858
# pull requests read. A push to main the queue did not pass, a merge group, the release's own call
59-
# of these checks and a pull request labelled `full-ci` run everything.
59+
# of these checks and a pull request labelled `full-ci` run everything. CHANGELOG.md is never a
60+
# reason to run anything: the release writes it, so a pull request leaves its change out of every
61+
# decision, and a merge group that changes nothing else runs nothing.
6062
changes:
6163
name: changes
6264
# A standard runner: it reads the API for a few seconds, and every other job waits on it,
@@ -84,6 +86,7 @@ jobs:
8486
webkit_tests: ${{ steps.decide.outputs.webkit_tests }}
8587
desktop_browser_tests: ${{ steps.decide.outputs.desktop_browser_tests }}
8688
queue_run: ${{ steps.decide.outputs.queue_run }}
89+
ignored_only: ${{ steps.decide.outputs.ignored_only }}
8790
steps:
8891
# A pull request's history, without file contents (a diff of names needs only the trees); any
8992
# other event needs none.
@@ -985,8 +988,10 @@ jobs:
985988
contents: read
986989
# To cancel this run at its first failure (.github/actions/stop-on-failure).
987990
actions: write
991+
# Not in a merge group that changes only CHANGELOG.md: its images are the ones main built.
992+
needs: changes
988993
if: >-
989-
github.event_name != 'pull_request' ||
994+
(github.event_name != 'pull_request' && needs.changes.outputs.ignored_only != 'true') ||
990995
contains(github.event.pull_request.labels.*.name, 'full-ci')
991996
outputs:
992997
components: ${{ steps.list.outputs.components }}
@@ -1057,6 +1062,52 @@ jobs:
10571062
- if: failure()
10581063
uses: $/.github/actions/stop-on-failure
10591064

1065+
# CHANGELOG.md is the release's, and a pull request's note is in its description, under
1066+
# `## Changelog` (scripts/release-note-check.ts): this fails a pull request that changes
1067+
# CHANGELOG.md, other than the release's own, one with no note, and one that deprecates part of
1068+
# the API without naming it in its note. It runs last, after every other job, and reads the
1069+
# description then, so a description edited while the tests run is the one checked; one edited
1070+
# after the run re-runs it (release-note-edited.yml). Running last, its stop step
1071+
# (.github/actions/stop-on-failure) has nothing left to cancel. A pull request only: a merge group's pull requests each passed it,
1072+
# and nothing else has a description.
1073+
release-note:
1074+
name: release note
1075+
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
1076+
needs: [changes, static, api, mobile, app-browser, app-browser-webkit, app-browser-desktop, test, test-total, changed-tests, startup, langgraph-ts, python-harness, python-harness-compose, build, component-list, component-dockerfiles]
1077+
runs-on: ubuntu-latest
1078+
timeout-minutes: 5 # usually seconds
1079+
permissions:
1080+
contents: read
1081+
# To read the pull request's description and files.
1082+
pull-requests: read
1083+
# To cancel this run at its first failure (.github/actions/stop-on-failure).
1084+
actions: write
1085+
steps:
1086+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1087+
with:
1088+
persist-credentials: false
1089+
# The check and what it imports, and the action its last step uses.
1090+
sparse-checkout: |
1091+
scripts/release-note-check.ts
1092+
scripts/release-notes.ts
1093+
shared/api-deprecations.ts
1094+
shared/client-version.ts
1095+
package.json
1096+
release-policy.json
1097+
.github/actions/stop-on-failure
1098+
sparse-checkout-cone-mode: false
1099+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
1100+
with:
1101+
bun-version: 1.4.3
1102+
no-cache: true
1103+
- name: CHANGELOG.md is the release's, and the description has the note
1104+
env:
1105+
GH_TOKEN: ${{ github.token }}
1106+
run: bun scripts/release-note-check.ts
1107+
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
1108+
- if: failure()
1109+
uses: $/.github/actions/stop-on-failure
1110+
10601111
# One check for branch protection to require. A new job above is covered by this without anybody
10611112
# remembering to add it to a list, and a job that was skipped for the wrong reason is not a pass.
10621113
# A job `changes` found nothing to do for is skipped and passes; `changes` itself must succeed, so
@@ -1069,7 +1120,7 @@ jobs:
10691120
runs-on: ubuntu-latest
10701121
timeout-minutes: 5 # usually seconds
10711122
if: always()
1072-
needs: [changes, static, api, mobile, app-browser, app-browser-webkit, app-browser-desktop, test, test-total, changed-tests, startup, langgraph-ts, python-harness, python-harness-compose, build, component-list, component-dockerfiles]
1123+
needs: [changes, release-note, static, api, mobile, app-browser, app-browser-webkit, app-browser-desktop, test, test-total, changed-tests, startup, langgraph-ts, python-harness, python-harness-compose, build, component-list, component-dockerfiles]
10731124
permissions:
10741125
contents: read
10751126
# To name the jobs that failed. A job that stopped its run at its first failure is recorded

‎.github/workflows/desktop-macos-signing.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ on:
3434
required: false
3535
# Pull requests and pushes to main run only the credential-free checks; the signing job's `if`
3636
# admits a `v*` tag or an explicit dispatch and nothing else, so no pull request reaches the
37-
# environment.
37+
# environment. Markdown is prose nothing here reads (scripts/ci-changes.ts, isDocs).
3838
pull_request:
3939
paths:
4040
- desktop/**
@@ -46,7 +46,7 @@ on:
4646
- scripts/release-*
4747
- scripts/downloads-*
4848
- .github/workflows/downloads-sync.yml
49-
- docs/releasing.md
49+
- "!**/*.md"
5050
push:
5151
branches: [main]
5252
tags: ["v*"]
@@ -60,7 +60,7 @@ on:
6060
- scripts/release-*
6161
- scripts/downloads-*
6262
- .github/workflows/downloads-sync.yml
63-
- docs/releasing.md
63+
- "!**/*.md"
6464

6565
permissions:
6666
contents: read

‎.github/workflows/desktop-signing.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ on:
3333
- .github/workflows/desktop-signing.yml
3434
- .github/workflows/publish-release.yml
3535
- scripts/release-*
36-
- docs/windows-signing.md
36+
# Prose nothing here reads (scripts/ci-changes.ts, isDocs).
37+
- "!**/*.md"
3738

3839
permissions:
3940
contents: read

‎.github/workflows/desktop.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ name: Desktop
99
# it at runtime with an `expect`, so a bad row panics the window rather than failing a type check.
1010
on:
1111
pull_request:
12-
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
12+
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml", "!**/*.md"]
1313
push:
1414
branches: [main]
15-
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
15+
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml", "!**/*.md"]
1616
workflow_call:
1717

1818
permissions:

‎.github/workflows/publish-release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ jobs:
330330
# their run at its first failure (.github/actions/stop-on-failure). On this push event `changes`
331331
# reads nothing and runs every check, and nothing is cancelled.
332332
actions: write
333+
# CI's `release note` asks for it, to read a pull request's description. It runs on a pull
334+
# request only, so on this push it is skipped and reads nothing.
335+
pull-requests: read
333336

334337
# The images, built once from the commit that passed the checks above, and tagged with this
335338
# release's version and `latest`, with the server, computer and supervisor pinned at the tag this
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release note edited
2+
3+
# A pull request's release note is in its description (scripts/release-note-check.ts), and editing a
4+
# description starts no CI run. So when the description changes after CI's run of the pull request's
5+
# head has finished with its `release note` check failed, this re-runs that run's failed jobs: the
6+
# check reads the description again, and `verify` follows it. Nothing else runs again, since every
7+
# other job of the run passed or is re-run only because it failed. While the run is still going,
8+
# nothing is needed: the check runs last and reads the description then.
9+
#
10+
# Pull requests from this repository: a fork's token is read-only and cannot re-run. A maintainer
11+
# re-runs a fork's failed jobs by hand.
12+
on:
13+
pull_request:
14+
types: [edited]
15+
16+
permissions: {}
17+
18+
concurrency:
19+
group: release-note-edited-${{ github.event.pull_request.number }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
rerun:
24+
name: re-run the release note
25+
if: >-
26+
github.event.pull_request.head.repo.full_name == github.repository &&
27+
github.event.changes.body != null
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 5 # seconds
30+
permissions:
31+
# To read CI's runs and re-run one.
32+
actions: write
33+
steps:
34+
- name: Re-run CI's failed release note on the pull request's head
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
REPOSITORY: ${{ github.repository }}
38+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
39+
run: |
40+
set -euo pipefail
41+
run="$(gh api "repos/$REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$HEAD_SHA&event=pull_request&per_page=1" \
42+
--jq '.workflow_runs[0] | select(.) | "\(.id) \(.status)"')"
43+
if [ -z "$run" ]; then
44+
echo "CI has not run on $HEAD_SHA yet. Its release note check will read this description."
45+
exit 0
46+
fi
47+
id="${run% *}"
48+
status="${run#* }"
49+
if [ "$status" != completed ]; then
50+
echo "CI's run $id is still going. Its release note check runs last and reads this description."
51+
exit 0
52+
fi
53+
note="$(gh api "repos/$REPOSITORY/actions/runs/$id/jobs?filter=latest&per_page=100" \
54+
--jq '[.jobs[] | select(.name == "release note")][0].conclusion // ""')"
55+
if [ "$note" != failure ]; then
56+
echo "CI's run $id has its release note check at '${note:-not run}'. Nothing to re-run."
57+
exit 0
58+
fi
59+
gh run rerun "$id" --failed --repo "$REPOSITORY"
60+
echo "Re-ran the failed jobs of CI's run $id, so the release note check reads the edited description."

‎.github/workflows/release.yml‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,13 @@ jobs:
102102
bun-version: 1.4.3
103103

104104
- id: prepare
105-
name: Write the version and promote the notes
105+
name: Write the version and the notes
106106
env:
107107
BUMP: ${{ inputs.bump }}
108108
KIND: ${{ inputs.kind }}
109+
# The notes are read from the descriptions of the pull requests this release ships,
110+
# through the API (scripts/release-collect-notes.ts).
111+
GH_TOKEN: ${{ github.token }}
109112
run: |
110113
set -euo pipefail
111114
current=$(bun -e 'console.log(require("./package.json").version)')
@@ -187,17 +190,22 @@ jobs:
187190
echo "sha=$(git rev-parse HEAD)"
188191
} >> "$GITHUB_OUTPUT"
189192
190-
# Writes the version, the OpenBot image tag, the Cargo files and the changelog, and
191-
# refuses a changelog with nothing under Unreleased. It appends version, base and the path
192-
# of a file holding the notes to $GITHUB_OUTPUT for the steps below.
193+
# Writes the version, the OpenBot image tag, the Cargo files and the changelog. The
194+
# changelog is written here and nowhere else: its section is the notes under `## Changelog`
195+
# in the description of every pull request merged since the previous stable release, with
196+
# whatever still sits under Unreleased (scripts/release-prepare.ts). It refuses a release
197+
# with a pull request whose note is missing or unreadable, naming it (edit that pull
198+
# request's description and run this again), one with no notes at all, and one whose
199+
# changelog would not list a deprecation the API spec makes. It appends version, base and
200+
# the path of a file holding the notes to $GITHUB_OUTPUT for the steps below.
193201
bun scripts/release-prepare.ts "$BUMP" "$KIND"
194202
195203
# The notes can be longer than the 65,536 characters GitHub allows in a PR body. The action
196204
# below cuts a longer body to that length and warns (src/main.ts in its v8.1.1). The checklist
197205
# comes first, so the cut only drops the end of the notes. The whole section is still in the
198206
# CHANGELOG.md diff of the PR, and the published release reads it from there, not from here.
199207
# The notes come through a file: an environment variable over 128 KB makes the shell fail with
200-
# "Argument list too long", and the Unreleased section can grow past that. The notes have no
208+
# "Argument list too long", and a release's notes can grow past that. The notes have no
201209
# trailing newline, so the bare echo after cat ends their last line.
202210
- name: Write the PR body
203211
env:
@@ -226,7 +234,7 @@ jobs:
226234
echo "changes only the release files, main's passing CI on the commit it merges onto."
227235
echo "There is nothing to check about CI here."
228236
echo
229-
# A prerelease does not promote the changelog, so these are what is under Unreleased.
237+
# A prerelease writes its notes under Unreleased, and is published from there.
230238
echo '```'
231239
echo
232240
cat "$NOTES_FILE"

‎CONTRIBUTING.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@ what it changes and why.
1010
optional.** OpenBot is live. Anything a released app uses keeps working for 12 months, and a
1111
migration never breaks a running server. CI enforces most of it; the page says what and how.
1212

13+
## The release note goes in the description, not in CHANGELOG.md
14+
15+
`CHANGELOG.md` is written by the release, and by nothing else. Your pull request's description
16+
carries its note, under `## Changelog` (the template has the heading): what a deployment does
17+
differently afterwards, for the person deciding whether to upgrade, each line under a bold heading
18+
on a line of its own, the way `CHANGELOG.md` groups them. Write `none` when nobody running OpenBot
19+
would notice. Preparing a release collects the notes of every pull request it ships into its section
20+
of `CHANGELOG.md`.
21+
22+
```md
23+
## Changelog
24+
25+
**API.**
26+
27+
- **Added: reading an app with its actions in a body.** What changes for a deployment.
28+
```
29+
30+
CI's `release note` check fails a pull request that changes `CHANGELOG.md`, has no note, or
31+
deprecates part of the API without naming it in the note with its sunset. It reads the description
32+
at the end of the run, so an edit made while CI runs counts; after the run, a maintainer re-runs it
33+
for a pull request from a fork, and a branch of this repository's re-runs on its own when the
34+
description is edited. Nothing needs to be pushed. A note can still be corrected after the pull
35+
request merges, by editing its description before the release is prepared.
36+
1337
## How CI runs on your pull request
1438

1539
- **A maintainer approves it first.** CI on a pull request from an outside contributor waits for a

0 commit comments

Comments
 (0)