Skip to content

Commit 2185338

Browse files
Copilotpljones
andcommitted
feat: commit ReleaseAnnouncement.md per-PR in backfill script
Co-authored-by: pljones <1549463+pljones@users.noreply.github.com>
1 parent e102ac5 commit 2185338

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

.github/workflows/backfill-release-announcement.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ name: Backfill Release Announcement
99
# up exactly as it would have done if the per-PR workflow had been running all
1010
# along.
1111
#
12-
# The resulting commit is pushed directly to main. Review it and amend or
13-
# revert as needed before the release is published.
12+
# The script commits one separate commit per PR that produced a user-relevant
13+
# change, then this workflow pushes them all to main in one go. Review the
14+
# individual commits and amend or revert as needed before the release is
15+
# published.
1416

1517
on:
1618
workflow_dispatch:
@@ -58,15 +60,11 @@ jobs:
5860
run: |
5961
bash tools/backfill-release-announcement.sh "${{ inputs.since_tag }}"
6062
61-
- name: Commit and push updated announcement
63+
- name: Push commits
6264
if: inputs.dry_run != 'true'
6365
env:
6466
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6567
run: |
66-
git config --global user.email "actions@github.com"
67-
git config --global user.name "github-actions[bot]"
68-
git add ReleaseAnnouncement.md
69-
# Exit cleanly if nothing changed (all PRs were internal/skipped).
70-
git diff --staged --quiet && echo "Nothing to commit." && exit 0
71-
git commit -m "docs: backfill Release Announcement from ${{ inputs.since_tag }}"
68+
# The backfill script commits one commit per PR that changed the
69+
# announcement. All that is left to do here is push them.
7270
git push

tools/backfill-release-announcement.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ require_cmd() {
8888

8989
# ── pre-flight checks ──────────────────────────────────────────────────────
9090

91+
require_cmd git
9192
require_cmd gh
9293
require_cmd jq
9394
require_cmd curl
@@ -197,6 +198,19 @@ if [[ -z "$SYSTEM_PROMPT" ]]; then
197198
exit 1
198199
fi
199200

201+
# ── configure git identity (required for commits) ─────────────────────────
202+
# Use existing config when available; fall back to neutral defaults so the
203+
# script works in CI environments that have no pre-configured identity.
204+
205+
if [[ "$DRY_RUN" != "true" ]]; then
206+
if ! git config user.email > /dev/null 2>&1; then
207+
git config user.email "actions@github.com"
208+
fi
209+
if ! git config user.name > /dev/null 2>&1; then
210+
git config user.name "github-actions[bot]"
211+
fi
212+
fi
213+
200214
# ── process each PR ────────────────────────────────────────────────────────
201215

202216
call_model_api() {
@@ -297,6 +311,10 @@ for row in $(jq -r '.[] | @base64' <<< "$PR_JSON"); do
297311
# ── write the updated file ─────────────────────────────────────────────
298312
printf '%s' "$updated_announcement" > "$ANNOUNCEMENT_FILE"
299313
success "Updated announcement with changes from PR #${pr_number}."
314+
315+
# ── commit this PR's change as its own commit ──────────────────────────
316+
git add "$ANNOUNCEMENT_FILE"
317+
git commit -m "Release announcement: ${pr_info}"
300318
PROCESSED=$((PROCESSED + 1))
301319
done
302320

@@ -310,9 +328,8 @@ info "PRs with no user-relevant changes: ${UNCHANGED}"
310328
if [[ "$DRY_RUN" == "true" ]]; then
311329
warn "DRY_RUN=true — no files were modified."
312330
else
313-
success "ReleaseAnnouncement.md has been updated."
331+
success "ReleaseAnnouncement.md has been updated and each change committed."
314332
echo
315-
echo "Review the result, then commit with:"
316-
echo " git add ReleaseAnnouncement.md"
317-
echo " git commit -m 'docs: backfill Release Announcement from ${SINCE_TAG}'"
333+
echo "Push all commits with:"
334+
echo " git push"
318335
fi

0 commit comments

Comments
 (0)