1919
2020permissions :
2121 contents : write
22+ pull-requests : write
2223
2324jobs :
2425 # ── Windows .exe build ──────────────────────────────────────
@@ -248,8 +249,16 @@ jobs:
248249 artifacts/Bulk.PDF.Generator.macOS.dmg
249250
250251 # ── Clear RELEASE_NOTES.md so it's ready for the next release ──
251- - name : Clear release notes
252+ # Direct push to main is blocked by branch protection (status check required).
253+ # Instead: commit to a short-lived branch, open a PR, and auto-merge it.
254+ # The test workflow runs on the PR; auto-merge fires when it passes.
255+ - name : Clear release notes via PR
256+ env :
257+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
252258 run : |
259+ BRANCH="ci/clear-notes-${{ github.ref_name }}"
260+ git checkout -b "$BRANCH"
261+
253262 cat > RELEASE_NOTES.md << 'TEMPLATE'
254263 <!-- Release notes for the next tagged release.
255264 The GitHub Actions workflow reads this file and injects it into the
@@ -265,8 +274,19 @@ jobs:
265274 - **Fixed: bug description** — What was broken and how it's fixed.
266275 -->
267276 TEMPLATE
277+
268278 git config user.name "github-actions[bot]"
269279 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
270280 git add RELEASE_NOTES.md
271- git diff --cached --quiet || git commit -m "ci: clear release notes after ${{ github.ref_name }} publish"
272- git push origin HEAD:main
281+ git diff --cached --quiet && echo "Nothing to clear, skipping PR." && exit 0
282+
283+ git commit -m "ci: clear release notes after ${{ github.ref_name }} publish"
284+ git push origin "$BRANCH"
285+
286+ gh pr create \
287+ --title "ci: clear release notes after ${{ github.ref_name }}" \
288+ --body "Automated post-release cleanup. Auto-merges once the test check passes." \
289+ --base main \
290+ --head "$BRANCH"
291+
292+ gh pr merge "$BRANCH" --auto --squash
0 commit comments