From 5d57658e36892f0ebb4e47f704b222b649d87a28 Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Sun, 10 May 2026 19:15:16 +0200 Subject: [PATCH] Fix changelog categorization and enhance script (#3955) * Fix categorization of PR #3949 in CHANGELOG.md * Enhance changelog.py to error on uncategorized PRs * Update skill to propose breaking changes to user --- CHANGELOG.md | 2 +- skills/maintenance/release-process/SKILL.md | 27 ++++++++++++------- ...vpc-access-connector-create-sharedvpc.yaml | 1 - tools/changelog.py | 8 ++++++ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2af127292..951c26047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,6 @@ All notable changes to this project will be documented in this file. - `terraform-google-provider-beta`: version updated to 7.29 which includes track_client_address field support for AlloyDB [[#3916](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3916)] - `modules`: Bump minimum OpenTofu version to 1.11.00 [[#3918](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3918)] -- [[#3949](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3949)] Fix random test failures by ignoring .git in copytree ([ludoo](https://github.com/ludoo)) ### FAST @@ -55,6 +54,7 @@ All notable changes to this project will be documented in this file. ### TOOLS - [[#3954](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3954)] Fix test race condition by ignoring pytest-* directories ([ludoo](https://github.com/ludoo)) +- [[#3949](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3949)] Fix random test failures by ignoring .git in copytree ([ludoo](https://github.com/ludoo)) - [[#3875](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3875)] Add Agent Engine identity type ([LucaPrete](https://github.com/LucaPrete)) - [[#3925](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3925)] Let `tfdoc.py` understand sensitive variables ([juliocc](https://github.com/juliocc)) - [[#3916](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/3916)] Add track_client_address field to `modules/alloydb` ([SamuPert](https://github.com/SamuPert)) diff --git a/skills/maintenance/release-process/SKILL.md b/skills/maintenance/release-process/SKILL.md index 459284887..727d1e397 100644 --- a/skills/maintenance/release-process/SKILL.md +++ b/skills/maintenance/release-process/SKILL.md @@ -97,29 +97,38 @@ You can create the release either automatically via the GitHub CLI or manually v ### Option A: Automated via GitHub CLI (Recommended) -This script extracts any "BREAKING CHANGES" from the changelog, converts the heading to Title Case, and prepends them to the automatically generated release notes. +This script extracts any "BREAKING CHANGES" from the changelog and converts the heading to Title Case. ```bash # 1. Extract the section for the new release from CHANGELOG.md # We use awk to grab everything from the new release header until the next release header -RELEASE_NOTES=$(awk "/^## \[$NEW_RELEASE\]/{flag=1; next} /^## \[v/{flag=0} flag" CHANGELOG.md) +RELEASE_NOTES=$(awk "/^## \[v$NEW_RELEASE\]/{flag=1; next} /^## \[v/{flag=0} flag" CHANGELOG.md) # 2. Extract just the BREAKING CHANGES section (if any) BREAKING_CHANGES=$(echo "$RELEASE_NOTES" | awk '/^### BREAKING CHANGES/{flag=1; print; next} /^### /{flag=0} flag') -# 3. Create the release +# 3. Format breaking changes if [ -n "$(echo "$BREAKING_CHANGES" | tr -d '[:space:]')" ]; then # Convert "### BREAKING CHANGES" to "### Breaking Changes" FORMATTED_BREAKING_CHANGES=$(echo "$BREAKING_CHANGES" | sed 's/^### BREAKING CHANGES/### Breaking Changes/') - - # Prepend breaking changes to the generated notes - gh release create "$NEW_RELEASE" --title "$NEW_RELEASE" --generate-notes --notes "$FORMATTED_BREAKING_CHANGES" -else - # Otherwise, just generate the standard notes - gh release create "$NEW_RELEASE" --title "$NEW_RELEASE" --generate-notes + echo "$FORMATTED_BREAKING_CHANGES" fi ``` +> **CRITICAL:** Show the extracted and formatted breaking changes to the user and wait for their approval before proceeding to create the release. + +Once approved, run the appropriate command to create the release. + +If there were breaking changes: +```bash +gh release create "$NEW_RELEASE" --title "$NEW_RELEASE" --generate-notes --notes "$FORMATTED_BREAKING_CHANGES" +``` + +If there were no breaking changes: +```bash +gh release create "$NEW_RELEASE" --title "$NEW_RELEASE" --generate-notes +``` + ### Option B: Manual via GitHub UI Go to the [GitHub Releases UI](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/releases/new) and configure the release: diff --git a/tests/modules/cloud_function_v2/examples/service-vpc-access-connector-create-sharedvpc.yaml b/tests/modules/cloud_function_v2/examples/service-vpc-access-connector-create-sharedvpc.yaml index e3cef2cec..fd6c30e80 100644 --- a/tests/modules/cloud_function_v2/examples/service-vpc-access-connector-create-sharedvpc.yaml +++ b/tests/modules/cloud_function_v2/examples/service-vpc-access-connector-create-sharedvpc.yaml @@ -22,7 +22,6 @@ values: - repo_source: [] storage_source: - bucket: bucket - object: bundle-95c1b0e5b92dae8333539b1e0ad5173b.zip worker_pool: null description: Terraform managed. effective_labels: diff --git a/tools/changelog.py b/tools/changelog.py index dbc045252..78fcd04dd 100755 --- a/tools/changelog.py +++ b/tools/changelog.py @@ -392,6 +392,14 @@ def main(token, changelog_file='CHANGELOG.md', bump=None, exclude_pull=None, exclude_pull)) logging.info(f'number of pulls: {len(pulls)}') pull_groups = group_pulls(pulls) + if pull_groups.get(None): + print("Error: Found uncategorized PRs (missing 'on:' label):") + for pr in pull_groups[None]: + url = f"https://github.com/{ORG}/{REPO}/pull/{pr.id}" + print(f"- #{pr.id}: {pr.title} -> {url}") + raise SystemExit( + "Please apply an 'on:' label to these PRs on GitHub and re-run the script." + ) upgrade_notes = [pr for pr in pulls if pr.upgrade_notes] rel_changes = format_release(pull_groups, upgrade_notes, release_as, release_to, release_from, date_to, date_from)