Skip to content

Commit 9f9937b

Browse files
avalleteclaude
andauthored
chore(ci): add manual backfill-release-notes workflow (#5316)
The plan job in release.yml runs cycjimmy/semantic-release-action in dry-run mode purely to compute the next version, never reading new_release_notes, and softprops/action-gh-release in release-shared.yml gets no body. The result: GH Releases since the monorepo move publish with empty bodies (e.g. v2.100.1). A subsequent change will plumb release notes through the production publish path. This commit lands the prerequisites only: - apps/cli/package.json: add @semantic-release/release-notes-generator to release.plugins. It's a default semantic-release plugin bundled in cycjimmy/semantic-release-action's image, so no devDep is needed. Without this, new_release_notes would be empty even after wiring. - .github/workflows/backfill-release-notes.yml: workflow_dispatch with tag and apply inputs. Re-stages the repo on develop/main at the tag's commit (without the tag, so semantic-release computes it as the next release), asserts the computed version matches the tag, dumps the notes to the job summary, and only updates the GH Release body when apply=true. Lets us validate the changelog format end-to-end against an existing tag before touching the production publish path, and doubles as a fix-forward tool for releases that ship with an empty body (e.g. v2.100.1, the recent betas, or any future workflow_dispatch re-cut). ## What kind of change does this PR introduce? Bug fix, feature, docs update, ... ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 801729b commit 9f9937b

2 files changed

Lines changed: 93 additions & 1 deletion

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Backfill release notes
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: Release tag to refresh (e.g. v2.100.1)
8+
required: true
9+
type: string
10+
apply:
11+
description: Update the GitHub release body (otherwise dry-run only)
12+
required: false
13+
type: boolean
14+
default: false
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
backfill:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
env:
25+
TAG: ${{ inputs.tag }}
26+
steps:
27+
- id: app-token
28+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
29+
with:
30+
app-id: ${{ secrets.APP_ID }}
31+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
32+
33+
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- uses: ./.github/actions/setup
39+
40+
# semantic-release computes the *next* release based on commits since the
41+
# latest channel tag. To re-derive notes for an existing tag, delete the
42+
# tag locally and synthesise a branch name that matches the channel
43+
# config in apps/cli/package.json (main / develop) at the tag's commit.
44+
- name: Re-stage repo as if $TAG were unpublished
45+
run: |
46+
set -euo pipefail
47+
sha=$(git rev-list -n 1 "$TAG")
48+
git tag -d "$TAG"
49+
if [[ "$TAG" == *-beta.* ]]; then
50+
branch=develop
51+
else
52+
branch=main
53+
fi
54+
git checkout -B "$branch" "$sha"
55+
echo "Re-staged on $branch @ $sha (without tag $TAG)"
56+
57+
- id: sr
58+
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
59+
with:
60+
working_directory: apps/cli
61+
dry_run: true
62+
env:
63+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
64+
65+
- name: Verify computed version matches $TAG
66+
env:
67+
SR_VERSION: ${{ steps.sr.outputs.new_release_version }}
68+
run: |
69+
set -euo pipefail
70+
want="${TAG#v}"
71+
if [[ "$SR_VERSION" != "$want" ]]; then
72+
echo "::error::semantic-release computed v$SR_VERSION but tag is $TAG; check channel config / tag history"
73+
exit 1
74+
fi
75+
76+
- name: Show generated notes
77+
env:
78+
NOTES: ${{ steps.sr.outputs.new_release_notes }}
79+
run: |
80+
{
81+
echo "## Notes for $TAG"
82+
echo
83+
printf '%s\n' "$NOTES"
84+
} >> "$GITHUB_STEP_SUMMARY"
85+
printf '%s\n' "$NOTES" > notes.md
86+
87+
- name: Update GitHub Release body
88+
if: inputs.apply
89+
env:
90+
GH_TOKEN: ${{ github.token }}
91+
run: gh release edit "$TAG" --notes-file notes.md

apps/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
}
8686
],
8787
"plugins": [
88-
"@semantic-release/commit-analyzer"
88+
"@semantic-release/commit-analyzer",
89+
"@semantic-release/release-notes-generator"
8990
]
9091
},
9192
"knip": {

0 commit comments

Comments
 (0)