Skip to content

Commit e0bd3fc

Browse files
committed
fix: pin checkout to default branch, use notes-file, anchor CHANGELOG grep
- Add ref: master/main to actions/checkout in all prepare/publish workflows so workflows always operate on the default branch regardless of dispatch ref - Replace shell-injection-prone ${{ steps...outputs.notes }} pattern with --notes-file using $RUNNER_TEMP/release-notes.md (safe from backticks/quotes in changelog content) - Treat empty [Unreleased] section as a hard error in prepare-release - Fix CHANGELOG verification grep: grep -qE "^## \[VERSION\]" (anchored, prevents substring matches and prefix collisions like 3.1.0 vs 3.1.0-rc1)
1 parent 3d4632f commit e0bd3fc

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424
with:
25+
ref: master
2526
token: ${{ secrets.GITHUB_TOKEN }}
2627

2728
- name: Validate version format
@@ -50,6 +51,8 @@ jobs:
5051
} > "$temp_file"
5152
mv "$temp_file" "$changelog_file"
5253
54+
echo "See CHANGELOG.md for release notes." > "$RUNNER_TEMP/release-notes.md"
55+
5356
- name: Bump package.json version
5457
run: npm --no-git-tag-version --allow-same-version version "${{ github.event.inputs.version }}"
5558

@@ -88,5 +91,5 @@ jobs:
8891
gh release create "$version" \
8992
--draft \
9093
--title "$version" \
91-
--notes "See CHANGELOG.md for release notes."
94+
--notes-file "$RUNNER_TEMP/release-notes.md"
9295
fi

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ jobs:
2121
environment: npm
2222
steps:
2323
- uses: actions/checkout@v4
24+
with:
25+
ref: master
2426

2527
- name: Verify release is ready
2628
run: |
27-
if ! grep -qF "## $VERSION" CHANGELOG.md; then
29+
if ! grep -qE "^## $VERSION\b" CHANGELOG.md; then
2830
echo "::error::CHANGELOG.md has no entry for $VERSION. Merge the prepare-release PR to master before running this workflow."
2931
exit 1
3032
fi

0 commit comments

Comments
 (0)