Skip to content

Commit 5758b3d

Browse files
committed
ci: address review feedback on PR labels and release steps
- Run the title job on pushes too. GitHub keeps one pending run per concurrency group, so a push could replace a queued run for a title edit and leave labels for the old title. - Remove the migration label when a PR no longer adds a migration. - RELEASING.md: fetch tags before picking the version, sort tags by version rather than date, and use a VERSION variable instead of a hard-coded tag in the tag and push commands. - RELEASING.md: note that a PR appears in only one release-note section, so a breaking change with a migration is listed under Breaking changes. Signed-off-by: mday-io <mdaytn@gmail.com>
1 parent 0312681 commit 5758b3d

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

‎.github/workflows/pr-labels.yaml‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ concurrency:
2222
jobs:
2323
title:
2424
name: Check title and label by type
25-
# The title can't change on a push, so there is nothing to do.
26-
if: github.event.action != 'synchronize'
25+
# Runs on pushes too: GitHub keeps only one pending run per concurrency
26+
# group, so a push can replace a queued run for a title edit.
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/github-script@v8
@@ -135,7 +135,19 @@ jobs:
135135
const added = files.some(
136136
(f) => f.status === 'added' && /^sqlmesh\/migrations\/v\d+_.*\.py$/.test(f.filename)
137137
);
138-
if (!added) return;
138+
const labels = context.payload.pull_request.labels.map((l) => l.name);
139+
if (!added) {
140+
// The PR no longer adds a migration, e.g. the file was removed.
141+
if (labels.includes('migration')) {
142+
try {
143+
await github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'migration' });
144+
} catch (e) {
145+
if (e.status !== 404) throw e;
146+
}
147+
}
148+
return;
149+
}
150+
if (labels.includes('migration')) return;
139151
try {
140152
await github.rest.issues.getLabel({ owner, repo, name: 'migration' });
141153
} catch (e) {

‎RELEASING.md‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@ Each step publishes immediately and there's no approval gate. Check `main` befor
2424
### Steps
2525

2626
1. Pick the commit to release. It must be on `main`, and every required check must pass on it. Check the latest **pr.yaml** run for that commit on the [Actions page](https://github.com/SQLMesh/sqlmesh/actions/workflows/pr.yaml).
27-
2. Pick the version. Find the latest tag with `git tag --sort=-creatordate | head -1` and increment it.
28-
3. Tag the commit and push the tag:
27+
2. Pick the version. Fetch the tags, then find the highest released version and increment it:
2928

3029
```bash
3130
git fetch <sqlmesh-remote> main --tags
32-
git tag v0.236.5 <commit-sha>
33-
git push <sqlmesh-remote> v0.236.5
31+
git tag --list 'v[0-9]*' --sort=-v:refname | head -1
3432
```
3533

36-
Replace `<sqlmesh-remote>` with your remote for `SQLMesh/sqlmesh`. Push only the tag, not a branch.
34+
Replace `<sqlmesh-remote>` with your remote for `SQLMesh/sqlmesh`.
35+
36+
3. Tag the commit and push the tag. Set `VERSION` to the version from step 2, for example `v0.236.5`:
37+
38+
```bash
39+
VERSION=v0.236.5
40+
git tag "$VERSION" <commit-sha>
41+
git push <sqlmesh-remote> "$VERSION"
42+
```
43+
44+
Push only the tag, not a branch.
3745

3846
4. Watch the [Release](https://github.com/SQLMesh/sqlmesh/actions/workflows/release.yaml) run until it finishes.
3947
5. Check that the new version is on [PyPI](https://pypi.org/project/sqlmesh/#history).
@@ -49,6 +57,8 @@ GitHub builds the notes from merged pull request titles and groups them by label
4957
- A pull request that adds a state migration goes under **State migrations**.
5058
- CI, test and Dependabot pull requests are left out. Add the `skip-changelog` label to leave out any other pull request.
5159
60+
Each pull request appears in only one section: the first one in this list that matches its labels. A breaking change that also adds a state migration is listed under **Breaking changes**, so its upgrade note in step 6 should say to run `sqlmesh migrate`.
61+
5262
To move a pull request to another section, change its title. The workflow resets the type labels from the title.
5363
5464
## Release the VS Code Extension

0 commit comments

Comments
 (0)