Skip to content

Commit fad9058

Browse files
authored
fix: rolling release notes cover only the span since the previous ship (#79)
The reused rolling release called generate_release_notes on every update, and the generated 'What's Changed' accumulated onto the existing body each ship — after a high-volume day the description grew unreadably long. Auto-ship now generates notes explicitly for previous-rolling-tag -> shipped-commit (before the tag force-moves) via the generate-notes API and replaces the body outright; the compare link is rewritten to real SHAs since the synthetic tag never exists. Milestone v* tag releases are fresh releases and keep GitHub-generated notes.
1 parent a3e64d2 commit fad9058

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,35 @@ jobs:
439439
remote-daemon-assets/programad-remote-*
440440
if-no-files-found: error
441441

442+
- name: Generate rolling release notes (since previous ship)
443+
id: rolling_notes
444+
if: github.event_name == 'workflow_run' && steps.guard_release_assets.outputs.skip_all != 'true'
445+
env:
446+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
447+
run: |
448+
set -euo pipefail
449+
# The rolling release is reused each ship; generate_release_notes on an
450+
# existing release accumulates every past ship's "What's Changed" into
451+
# one ever-growing body. Instead, generate notes for just the span since
452+
# the previous ship (old rolling tag -> new commit) and REPLACE the body.
453+
# Must run BEFORE the rolling tag is force-moved below.
454+
NEW_SHA="${{ github.event.workflow_run.head_sha }}"
455+
ARGS=(-f tag_name="rolling-next" -f target_commitish="$NEW_SHA")
456+
PREV_SHA=""
457+
if PREV_SHA=$(gh api "repos/${{ github.repository }}/git/ref/tags/rolling" --jq .object.sha 2>/dev/null); then
458+
ARGS+=(-f previous_tag_name="rolling")
459+
fi
460+
BODY=$(gh api "repos/${{ github.repository }}/releases/generate-notes" "${ARGS[@]}" --jq .body)
461+
# The synthetic rolling-next tag never exists; fix the compare link to real SHAs.
462+
if [ -n "$PREV_SHA" ]; then
463+
BODY=$(printf '%s' "$BODY" | sed "s|/compare/rolling...rolling-next|/compare/${PREV_SHA}...${NEW_SHA}|")
464+
fi
465+
{
466+
echo "body<<PROGRAMA_ROLLING_NOTES_EOF"
467+
printf '%s\n' "$BODY"
468+
echo "PROGRAMA_ROLLING_NOTES_EOF"
469+
} >> "$GITHUB_OUTPUT"
470+
442471
- name: Move rolling tag to shipped commit
443472
if: github.event_name == 'workflow_run' && steps.guard_release_assets.outputs.skip_all != 'true'
444473
run: |
@@ -464,7 +493,11 @@ jobs:
464493
remote-daemon-assets/programad-remote-linux-amd64
465494
remote-daemon-assets/programad-remote-checksums.txt
466495
remote-daemon-assets/programad-remote-manifest.json
467-
generate_release_notes: true
496+
# Auto-ship: replace the body with freshly-scoped notes (previous ship -> now)
497+
# so the reused rolling release doesn't accumulate every past "What's Changed".
498+
# Milestone v* tags: a fresh release, so GitHub-generated notes are fine.
499+
body: ${{ steps.rolling_notes.outputs.body }}
500+
generate_release_notes: ${{ env.IS_AUTO_SHIP != 'true' }}
468501
overwrite_files: true
469502

470503
- name: Cleanup keychain

0 commit comments

Comments
 (0)