chore: clean, fold, and sync the release changelog PR
Expands the release-cut changelog curation so the release PR looks good by default. curate_changelog.py now normalizes the newest section (unescape HTML entities, de-link stray @mentions, drop duplicate entries from the same change, lowercase each entry's leading word), folds large releases under a <details> block (sized by --fold-threshold / CHANGELOG_FOLD_THRESHOLD, default 12), and can emit the curated section via --section-out. The release-cut workflow now mirrors that section into the PR description, and its curation steps run whenever a release PR exists (not only when newly created), so regenerate runs stay curated too. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 944860270
This commit is contained in:
committed by
Copybara-Service
parent
1ac68752ad
commit
2de8a53525
@@ -110,22 +110,24 @@ jobs:
|
||||
manifest-file: ${{ steps.config.outputs.manifest_file }}
|
||||
target-branch: ${{ steps.config.outputs.candidate_branch }}
|
||||
|
||||
# Curate the changelog: draft a Highlights section on top of the
|
||||
# release-please output and commit it back to the release PR branch. The
|
||||
# Curate the changelog: clean up and (for large releases) fold the
|
||||
# release-please output, draft a Highlights section on top, commit it back
|
||||
# to the release PR branch, and sync the PR description to match. The
|
||||
# script falls back to an empty Highlights template if drafting fails, so
|
||||
# this step never blocks the release.
|
||||
# this step never blocks the release. Guarded on `pr` (not `prs_created`)
|
||||
# so it also runs when release-please updates an existing PR (regenerate).
|
||||
- name: Set up Python
|
||||
if: steps.release_please.outputs.prs_created == 'true'
|
||||
if: steps.release_please.outputs.pr != ''
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install changelog curation dependencies
|
||||
if: steps.release_please.outputs.prs_created == 'true'
|
||||
if: steps.release_please.outputs.pr != ''
|
||||
run: pip install --upgrade google-genai
|
||||
|
||||
- name: Curate changelog Highlights
|
||||
if: steps.release_please.outputs.prs_created == 'true'
|
||||
if: steps.release_please.outputs.pr != ''
|
||||
# Curation is a nice-to-have layered on top of the release PR; never let
|
||||
# it turn the release run red (e.g. a push race or a transient error).
|
||||
continue-on-error: true
|
||||
@@ -137,12 +139,20 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PR_BRANCH=$(echo "$RELEASE_PR" | jq -r '.headBranchName')
|
||||
echo "Curating changelog on release PR branch: $PR_BRANCH"
|
||||
PR_NUMBER=$(echo "$RELEASE_PR" | jq -r '.number')
|
||||
echo "Curating changelog on release PR #$PR_NUMBER (branch: $PR_BRANCH)"
|
||||
git fetch origin "$PR_BRANCH"
|
||||
git checkout -B "$PR_BRANCH" FETCH_HEAD
|
||||
python scripts/curate_changelog.py --changelog CHANGELOG.md
|
||||
python scripts/curate_changelog.py --changelog CHANGELOG.md \
|
||||
--section-out /tmp/pr_body.md
|
||||
# Mirror the curated notes into the PR description so reviewers read
|
||||
# the same thing that ships in CHANGELOG.md. Done regardless of whether
|
||||
# the file changed, since the body is regenerated by release-please.
|
||||
if [ -s /tmp/pr_body.md ]; then
|
||||
gh pr edit "$PR_NUMBER" --body-file /tmp/pr_body.md
|
||||
fi
|
||||
if git diff --quiet -- CHANGELOG.md; then
|
||||
echo "No changelog changes to commit."
|
||||
echo "No changelog file changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
USER_JSON=$(gh api user)
|
||||
|
||||
Reference in New Issue
Block a user