Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ci-budgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"build": 3,
"component list": 1,
"component dockerfile (*)": 10,
"release note": 1,
"verify": 1
}
},
Expand Down
14 changes: 12 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@ conditional update, `LISTEN`/`NOTIFY` for fan-out.

## Changelog

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

**API.**

- **Added: what it is.** What a deployment does differently, and what to do about it.
-->

## Proof

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

# CHANGELOG.md is the release's, and a pull request's note is in its description, under
# `## Changelog` (scripts/release-note-check.ts): this fails a pull request that changes
# CHANGELOG.md, other than the release's own, one with no note, and one that deprecates part of
# the API without naming it in its note. It runs last, after every other job, and reads the
# description then, so a description edited while the tests run is the one checked; one edited
# after the run re-runs it (release-note-edited.yml). Running last, its stop step
# (.github/actions/stop-on-failure) has nothing left to cancel. A pull request only: a merge group's pull requests each passed it,
# and nothing else has a description.
release-note:
name: release note
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
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]
runs-on: ubuntu-latest
timeout-minutes: 5 # usually seconds
permissions:
contents: read
# To read the pull request's description and files.
pull-requests: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The check and what it imports, and the action its last step uses.
sparse-checkout: |
scripts/release-note-check.ts
scripts/release-notes.ts
shared/api-deprecations.ts
shared/client-version.ts
package.json
release-policy.json
.github/actions/stop-on-failure
sparse-checkout-cone-mode: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.3
no-cache: true
- name: CHANGELOG.md is the release's, and the description has the note
env:
GH_TOKEN: ${{ github.token }}
run: bun scripts/release-note-check.ts
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure

# One check for branch protection to require. A new job above is covered by this without anybody
# remembering to add it to a list, and a job that was skipped for the wrong reason is not a pass.
# A job `changes` found nothing to do for is skipped and passes; `changes` itself must succeed, so
Expand All @@ -1069,7 +1120,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5 # usually seconds
if: always()
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]
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]
permissions:
contents: read
# To name the jobs that failed. A job that stopped its run at its first failure is recorded
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/desktop-macos-signing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
required: false
# Pull requests and pushes to main run only the credential-free checks; the signing job's `if`
# admits a `v*` tag or an explicit dispatch and nothing else, so no pull request reaches the
# environment.
# environment. Markdown is prose nothing here reads (scripts/ci-changes.ts, isDocs).
pull_request:
paths:
- desktop/**
Expand All @@ -46,7 +46,7 @@ on:
- scripts/release-*
- scripts/downloads-*
- .github/workflows/downloads-sync.yml
- docs/releasing.md
- "!**/*.md"
push:
branches: [main]
tags: ["v*"]
Expand All @@ -60,7 +60,7 @@ on:
- scripts/release-*
- scripts/downloads-*
- .github/workflows/downloads-sync.yml
- docs/releasing.md
- "!**/*.md"

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/desktop-signing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ on:
- .github/workflows/desktop-signing.yml
- .github/workflows/publish-release.yml
- scripts/release-*
- docs/windows-signing.md
# Prose nothing here reads (scripts/ci-changes.ts, isDocs).
- "!**/*.md"

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ name: Desktop
# it at runtime with an `expect`, so a bad row panics the window rather than failing a type check.
on:
pull_request:
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"]
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"]
push:
branches: [main]
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"]
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"]
workflow_call:

permissions:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ jobs:
# their run at its first failure (.github/actions/stop-on-failure). On this push event `changes`
# reads nothing and runs every check, and nothing is cancelled.
actions: write
# CI's `release note` asks for it, to read a pull request's description. It runs on a pull
# request only, so on this push it is skipped and reads nothing.
pull-requests: read

# The images, built once from the commit that passed the checks above, and tagged with this
# release's version and `latest`, with the server, computer and supervisor pinned at the tag this
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release-note-edited.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release note edited

# A pull request's release note is in its description (scripts/release-note-check.ts), and editing a
# description starts no CI run. So when the description changes after CI's run of the pull request's
# head has finished with its `release note` check failed, this re-runs that run's failed jobs: the
# check reads the description again, and `verify` follows it. Nothing else runs again, since every
# other job of the run passed or is re-run only because it failed. While the run is still going,
# nothing is needed: the check runs last and reads the description then.
#
# Pull requests from this repository: a fork's token is read-only and cannot re-run. A maintainer
# re-runs a fork's failed jobs by hand.
on:
pull_request:
types: [edited]

permissions: {}

concurrency:
group: release-note-edited-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
rerun:
name: re-run the release note
if: >-
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.changes.body != null
runs-on: ubuntu-latest
timeout-minutes: 5 # seconds
permissions:
# To read CI's runs and re-run one.
actions: write
steps:
- name: Re-run CI's failed release note on the pull request's head
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
run="$(gh api "repos/$REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$HEAD_SHA&event=pull_request&per_page=1" \
--jq '.workflow_runs[0] | select(.) | "\(.id) \(.status)"')"
if [ -z "$run" ]; then
echo "CI has not run on $HEAD_SHA yet. Its release note check will read this description."
exit 0
fi
id="${run% *}"
status="${run#* }"
if [ "$status" != completed ]; then
echo "CI's run $id is still going. Its release note check runs last and reads this description."
exit 0
fi
note="$(gh api "repos/$REPOSITORY/actions/runs/$id/jobs?filter=latest&per_page=100" \
--jq '[.jobs[] | select(.name == "release note")][0].conclusion // ""')"
if [ "$note" != failure ]; then
echo "CI's run $id has its release note check at '${note:-not run}'. Nothing to re-run."
exit 0
fi
gh run rerun "$id" --failed --repo "$REPOSITORY"
echo "Re-ran the failed jobs of CI's run $id, so the release note check reads the edited description."
20 changes: 14 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ jobs:
bun-version: 1.4.3

- id: prepare
name: Write the version and promote the notes
name: Write the version and the notes
env:
BUMP: ${{ inputs.bump }}
KIND: ${{ inputs.kind }}
# The notes are read from the descriptions of the pull requests this release ships,
# through the API (scripts/release-collect-notes.ts).
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
current=$(bun -e 'console.log(require("./package.json").version)')
Expand Down Expand Up @@ -187,17 +190,22 @@ jobs:
echo "sha=$(git rev-parse HEAD)"
} >> "$GITHUB_OUTPUT"

# Writes the version, the OpenBot image tag, the Cargo files and the changelog, and
# refuses a changelog with nothing under Unreleased. It appends version, base and the path
# of a file holding the notes to $GITHUB_OUTPUT for the steps below.
# Writes the version, the OpenBot image tag, the Cargo files and the changelog. The
# changelog is written here and nowhere else: its section is the notes under `## Changelog`
# in the description of every pull request merged since the previous stable release, with
# whatever still sits under Unreleased (scripts/release-prepare.ts). It refuses a release
# with a pull request whose note is missing or unreadable, naming it (edit that pull
# request's description and run this again), one with no notes at all, and one whose
# changelog would not list a deprecation the API spec makes. It appends version, base and
# the path of a file holding the notes to $GITHUB_OUTPUT for the steps below.
bun scripts/release-prepare.ts "$BUMP" "$KIND"

# The notes can be longer than the 65,536 characters GitHub allows in a PR body. The action
# below cuts a longer body to that length and warns (src/main.ts in its v8.1.1). The checklist
# comes first, so the cut only drops the end of the notes. The whole section is still in the
# CHANGELOG.md diff of the PR, and the published release reads it from there, not from here.
# The notes come through a file: an environment variable over 128 KB makes the shell fail with
# "Argument list too long", and the Unreleased section can grow past that. The notes have no
# "Argument list too long", and a release's notes can grow past that. The notes have no
# trailing newline, so the bare echo after cat ends their last line.
- name: Write the PR body
env:
Expand Down Expand Up @@ -226,7 +234,7 @@ jobs:
echo "changes only the release files, main's passing CI on the commit it merges onto."
echo "There is nothing to check about CI here."
echo
# A prerelease does not promote the changelog, so these are what is under Unreleased.
# A prerelease writes its notes under Unreleased, and is published from there.
echo '```'
echo
cat "$NOTES_FILE"
Expand Down
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ what it changes and why.
optional.** OpenBot is live. Anything a released app uses keeps working for 12 months, and a
migration never breaks a running server. CI enforces most of it; the page says what and how.

## The release note goes in the description, not in CHANGELOG.md

`CHANGELOG.md` is written by the release, and by nothing else. Your pull request's description
carries its note, under `## Changelog` (the template has the heading): what a deployment does
differently afterwards, for the person deciding whether to upgrade, each line under a bold heading
on a line of its own, the way `CHANGELOG.md` groups them. Write `none` when nobody running OpenBot
would notice. Preparing a release collects the notes of every pull request it ships into its section
of `CHANGELOG.md`.

```md
## Changelog

**API.**

- **Added: reading an app with its actions in a body.** What changes for a deployment.
```

CI's `release note` check fails a pull request that changes `CHANGELOG.md`, has no note, or
deprecates part of the API without naming it in the note with its sunset. It reads the description
at the end of the run, so an edit made while CI runs counts; after the run, a maintainer re-runs it
for a pull request from a fork, and a branch of this repository's re-runs on its own when the
description is edited. Nothing needs to be pushed. A note can still be corrected after the pull
request merges, by editing its description before the release is prepared.

## How CI runs on your pull request

- **A maintainer approves it first.** CI on a pull request from an outside contributor waits for a
Expand Down
20 changes: 14 additions & 6 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,28 @@ exception: nothing can count it, so its sunset alone decides (below).
description: Deprecated. Send `schedule` instead.
```

2. List it in [CHANGELOG.md](../CHANGELOG.md), in the Deprecated list under `## Unreleased`'s
"Before upgrading": one line naming it as the server counts it, in backticks, with what replaces
it and its sunset. An operation is its method and path; a part of one adds `query <name>`,
`header <name>`, `body <property>` or `response <property>`, with `[]` for an array's items.
2. Name it in the pull request's release note, under `## Changelog` in its description and
`**Before upgrading.**` there: one line naming it as the server counts it, in backticks, with
what replaces it and its sunset. The release copies the note into the Deprecated list of its
section of [CHANGELOG.md](../CHANGELOG.md); nobody edits CHANGELOG.md by hand. An operation is
its method and path; a part of one adds `query <name>`, `header <name>`, `body <property>` or
`response <property>`, with `[]` for an array's items.

```markdown
## Changelog

**Before upgrading.**

- **Deprecated.** Each still works, answers with `Deprecation` and `Sunset` headers, and is
removed no earlier than its sunset, and only once nothing uses it.
- `PATCH /api/v2/organizations/{organizationId}/routines/{routineId} body cron`: send
`schedule` instead. Sunset 2027-12-01.
```

`shared/tests/api-deprecations.test.ts` fails a pull request whose marks are incomplete or whose
deprecations the changelog doesn't list. The server reads the same marks from the spec it is
`shared/tests/api-deprecations.test.ts` fails a pull request whose marks are incomplete, and CI's
`release note` check (scripts/release-note-check.ts) one whose note doesn't name each deprecation
it adds with its sunset. Preparing a release checks the same of every deprecation the spec marks,
against the CHANGELOG.md it writes. The server reads the same marks from the spec it is
generated from, so a request that uses a deprecated element is answered with `Deprecation`
([RFC 9745](https://www.rfc-editor.org/rfc/rfc9745.html)), `Sunset`
([RFC 8594](https://www.rfc-editor.org/rfc/rfc8594.html)) and `Link: <changelog>; rel="deprecation"`,
Expand Down
Loading
Loading