Skip to content

Commit a2e813c

Browse files
committed
ci(release): format release-please changelog headers
release-please writes changelog headers as `## [X.Y.Z](compare-url) (yyyy-MM-dd)`, but the CI "Version / Changelog" check expects `## [X.Y.Z] - dd.MM.yyyy.`, so merging release PR #4 as is would fail CI on master. Like HealthKitReporter, the release workflow now rewrites the header on the release PR branch with a `chore: format changelog` commit. Changes: - .github/workflows/release.yml: check out the release PR branch and rewrite CHANGELOG.md headers to the project format; use RELEASE_PLEASE_TOKEN when set so CI runs on release PRs Tests: release.yml parses; the sed expression turns `## [1.0.0](0.0.6...1.0.0) (2026-10-09)` into `## [1.0.0] - 09.10.2026.`
1 parent 1f862e6 commit a2e813c

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎.github/workflows/release.yml‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,31 @@ jobs:
1212
release-please:
1313
runs-on: ubuntu-26.04
1414
steps:
15-
- uses: googleapis/release-please-action@v5
15+
# A PAT / GitHub App token in RELEASE_PLEASE_TOKEN lets the release PR and its pushes trigger CI;
16+
# with the default GITHUB_TOKEN, CI doesn't run on the release PR.
17+
- id: release
18+
uses: googleapis/release-please-action@v5
1619
with:
20+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
1721
config-file: release-please-config.json
1822
manifest-file: .release-please-manifest.json
23+
24+
- name: Checkout release PR
25+
if: ${{ steps.release.outputs.pr }}
26+
uses: actions/checkout@v7
27+
with:
28+
ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
29+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
30+
31+
# release-please writes '## [X.Y.Z](compare-url) (yyyy-MM-dd)';
32+
# the project format, checked by CI, is '## [X.Y.Z] - dd.MM.yyyy.'.
33+
- name: Format CHANGELOG.md headers
34+
if: ${{ steps.release.outputs.pr }}
35+
run: |
36+
sed -E -i 's/^## \[?([0-9]+\.[0-9]+\.[0-9]+)\]?(\([^)]*\))? \(([0-9]{4})-([0-9]{2})-([0-9]{2})\)$/## [\1] - \5.\4.\3./' CHANGELOG.md
37+
if ! git diff --quiet CHANGELOG.md; then
38+
git config user.name "github-actions[bot]"
39+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
git commit -m "chore: format changelog" CHANGELOG.md
41+
git push
42+
fi

0 commit comments

Comments
 (0)