Skip to content

Commit 07bb605

Browse files
authored
ci: support curated release notes via RELEASE_NOTES.md (#134)
Add two steps to the release workflow: 1. Override: if RELEASE_NOTES.md exists on the tagged commit, replace the GitHub Release body with its contents via gh release edit. 2. Cleanup: after the release, create a PR to delete RELEASE_NOTES.md from main using a GitHub App token (so the PR triggers CI/auto-approve). When no RELEASE_NOTES.md is present, behavior is unchanged (release-please auto-generated notes are used as before). Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 4605a5c commit 07bb605

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ jobs:
7171
env:
7272
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7373
run: gh release upload "${{ needs.release-please.outputs.tag_name }}" patchloom.vsix
74+
- name: Apply custom release notes
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
if [ -f RELEASE_NOTES.md ]; then
79+
echo "Custom release notes found, updating release body..."
80+
gh release edit "${{ needs.release-please.outputs.tag_name }}" --notes-file RELEASE_NOTES.md
81+
else
82+
echo "No custom release notes, using auto-generated notes"
83+
fi
7484
# See ~/.grok/skills/vsce-publish/SKILL.md (or /vsce-publish) for the full
7585
# one-time browser setup (aex.dev.azure.com, PAT scopes, Open VSX agreement
7686
# + create-namespace + ownership claim), secret names, and troubleshooting.
@@ -97,3 +107,34 @@ jobs:
97107
color: blue
98108
namedLogo: visualstudiocode
99109
logoColor: white
110+
# Clean up RELEASE_NOTES.md after release (uses App token so the PR triggers CI/auto-approve)
111+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
112+
if: hashFiles('RELEASE_NOTES.md') != ''
113+
id: cleanup-token
114+
with:
115+
client-id: ${{ vars.APP_CLIENT_ID }}
116+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
117+
- name: Clean up release notes file
118+
if: steps.cleanup-token.outcome == 'success'
119+
env:
120+
GH_TOKEN: ${{ steps.cleanup-token.outputs.token }}
121+
run: |
122+
if git ls-tree HEAD --name-only | grep -q '^RELEASE_NOTES.md$'; then
123+
TAG="${{ needs.release-please.outputs.tag_name }}"
124+
BRANCH="chore/cleanup-release-notes-${TAG}"
125+
gh api "repos/${{ github.repository }}/git/refs" \
126+
-f ref="refs/heads/$BRANCH" \
127+
-f sha="$(git rev-parse HEAD)"
128+
FILE_SHA=$(gh api \
129+
"repos/${{ github.repository }}/contents/RELEASE_NOTES.md?ref=$BRANCH" \
130+
--jq '.sha')
131+
gh api --method DELETE \
132+
"repos/${{ github.repository }}/contents/RELEASE_NOTES.md" \
133+
-f message="chore: remove release notes override" \
134+
-f sha="$FILE_SHA" \
135+
-f branch="$BRANCH"
136+
PR_URL=$(gh pr create --base main --head "$BRANCH" \
137+
--title "chore: remove release notes override" \
138+
--body "Auto-cleanup after ${TAG} release.")
139+
gh pr merge "$PR_URL" --auto --squash
140+
fi

0 commit comments

Comments
 (0)