Infra 2576 update changelog automatically#140
Conversation
Signed-off-by: Pavel Dvorkin <pavel.dvorkin@consensys.net>
Signed-off-by: Pavel Dvorkin <pavel.dvorkin@consensys.net>
gauthierpetetin
left a comment
There was a problem hiding this comment.
Thanks for the PR @XxdpavelxX
There seems to be code duplication between .github/scripts/update-release-changelog.sh file and the create_changelog_pr function we have in .github/scripts/create-platform-release-pr.sh file. It would be great if both GitHub Actions were using the same code.
| # ----------------------------------------------------------------- | ||
|
|
||
| # Derive the semantic version from the branch naming convention. | ||
| if [[ "${RELEASE_BRANCH}" =~ ^Version-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then |
There was a problem hiding this comment.
We no longer need to support Version-v format.
| yarn --cwd install | ||
|
|
||
| echo "Generating test plan csv.." | ||
| yarn run gen:commits "${platform}" "${diff_base}" "${release_branch}" "${project_git_dir}" |
There was a problem hiding this comment.
Do we really need to generate commits CSV file? I may be missing something, but this seems to be something that was needed back in the days when we wanted to generate the release spreadsheet.
Is is not enough to run yarn auto-changelog update command since all we want is generate the changelog?
There was a problem hiding this comment.
I'm not sure. I kept that behavior since it was in the .github/scripts/create-platform-release-pr.sh function for updating the changelog. But will remove it. We can always add it back in the future if we decide to. https://github.com/MetaMask/github-tools/blob/main/.github/scripts/create-platform-release-pr.sh#L397#L398
|
I noticed this and thought about having both workflows use one script but decided that it would be better to decouple them. Here was my reasoning. Let me know what you think. @gauthierpetetin
We could add a followup cleanup task to update the old |
|
We could do it as a separate task if you prefer. But at some point we'll need one single script to generate the changelog because both scripts do exactly the same thing.
|
gauthierpetetin
left a comment
There was a problem hiding this comment.
I added 2 small comment. Otherwise, looks good to me.
Tested here: consensys-test/metamask-extension-test-workflow2#204, https://github.com/consensys-test/metamask-extension-test-workflow2/actions/runs/18538077577
Ticket: https://consensyssoftware.atlassian.net/browse/INFRA-2576
Added a new workflow to update or create the changelog when release PRs are created or receive new merges.
Update Release Changelog PR (update-release-changelog.yml)
When it runs:
Triggers on every push to release branches matching:
Version-v* (e.g., Version-v13.3.0)
release/[0-9]+.[0-9]+.[0-9]+ (e.g., release/999.98.0)
What it does:
Calls the github-tools update-release-changelog.yml workflow
This workflow runs the update-release-changelog.sh script
The script uses @metamask/auto-changelog to generate/update the changelog
When CHANGELOG.md Gets Created or Updated
Initial Creation:
Branch Creation: When you create a release/999.98.0 branch
Auto Create Release PR: Triggers and calls create-release-pr.yml
Create Release PR: Calls github-tools to create the release PR
Changelog Creation: The github-tools script:
Creates a changelog branch: release/999.98.0-Changelog
Runs yarn auto-changelog update --rc --autoCategorize --useChangelogEntry --useShortPrLink
Creates/updates CHANGELOG.md with commits since the last tag
Creates a PR: release: release/999.98.0-Changelog
Subsequent Updates:
New Commits: When you push new commits to release/999.98.0
Update Release Changelog PR: Triggers automatically
Changelog Update: The workflow:
Checks out the existing release/999.98.0-Changelog branch
Runs the auto-changelog script again
Updates the existing CHANGELOG.md with new commits
Commits and pushes the changes to the existing changelog PR
The auto-changelog looks for git tags to determine the commit range
Duplicate Filtering: It filters out commits that don't have PR numbers or are already in the changelog
Note
Introduce a reusable workflow and helper script to generate/update changelog branches and draft PRs for release branches using auto-changelog.
/.github/workflows/update-release-changelog.yml:release-branch,platform,repository-url, andprevious-version-ref; requiresgithub-token.MetaMask/github-tools, sets up env, installs deps, and runs changelog update script with write permissions./.github/scripts/update-release-changelog.shto:release/x.y.zbranch, determinerelease/<version>-Changelog(or fallback) branch, and checkout/create it.Written by Cursor Bugbot for commit bf1f24c. This will update automatically on new commits. Configure here.