Skip to content

feat: add Update Changelogs workflow with auto-changelog v6 --checkDeps#8443

Open
cryptodev-2s wants to merge 22 commits intomainfrom
feat/auto-changelog-check-deps
Open

feat: add Update Changelogs workflow with auto-changelog v6 --checkDeps#8443
cryptodev-2s wants to merge 22 commits intomainfrom
feat/auto-changelog-check-deps

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Apr 13, 2026

Explanation

Adds an Update Changelogs workflow that uses @metamask/auto-changelog v6's --checkDeps --fix feature to automatically validate and fix missing dependency bump changelog entries.

Triggers:

  • Automatic: When a release PR (release/* branch) is opened targeting main
  • On-demand: Comment @metamaskbot update-changelogs on any non-fork PR

What it does:

  1. Detects and skips fork PRs (security)
  2. Checks out the PR head branch
  3. Runs changelog:validate --checkDeps --fix --currentPr <PR#> across all packages
  4. Commits and pushes any CHANGELOG.md fixes back to the PR branch
  5. Comments on the PR with the result

Security:

  • Fork PRs are blocked via isCrossRepository check
  • All dynamic values use environment variables (no ${{ }} in run: blocks)
  • SHA-based checkout with branch name switch for release branch detection
  • 30-minute job timeout

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Adds a new GitHub Actions workflow that runs with write permissions and a PAT to push commits back to PR branches, so misconfiguration could cause unwanted automated commits/comments or workflow churn.

Overview
Adds a new Update Changelogs GitHub Actions workflow that can be triggered on release/* PR open events and via an @metamaskbot update-changelogs PR comment.

The workflow skips fork PRs, checks out the PR branch, runs changelog:validate --checkDeps --fix across workspaces, auto-commits/pushes any CHANGELOG.md fixes, and posts (and minimizes prior) status comments on the PR.

Reviewed by Cursor Bugbot for commit 0959ecc. Bugbot is set up for automated code reviews on this repo. Configure here.

@cryptodev-2s cryptodev-2s requested a review from a team as a code owner April 13, 2026 21:20
Comment thread .github/workflows/fix-changelogs.yml Fixed
Comment thread .github/workflows/fix-changelogs.yml Outdated
Comment thread .github/workflows/fix-changelogs.yml Outdated
Comment thread .github/workflows/fix-changelogs.yml Outdated
Comment thread .github/workflows/update-changelogs.yml Outdated
Comment thread .github/workflows/update-changelogs.yml Outdated
Comment thread .github/workflows/update-changelogs.yml
Comment thread .github/workflows/update-changelogs.yml
Comment thread .github/workflows/update-changelogs.yml Outdated
@cryptodev-2s cryptodev-2s changed the title feat: adopt auto-changelog v6 --checkDeps for dependency bump validation feat: add Update Changelogs workflow with auto-changelog v6 --checkDeps Apr 14, 2026
- Add --checkDeps to validate-changelog.sh to catch missing dep entries
- Add --checkDeps --fix to update-changelog.sh to auto-generate dep entries
- Add fix-changelogs workflow to auto-fix changelogs on release branches
- --checkDeps/--fix are validate-only flags, revert from update-changelog.sh
- Skip --checkDeps on main branch to avoid "HEAD is same as base" error
- Workflow uses validate --checkDeps --fix with PR number for auto-fixing
Keep dependency bump validation opt-in via @metamaskbot check-deps only.
- Add missing --checkDeps flag to validate step
- Fix shell quoting bug in fork detection
- Narrow git add to **/CHANGELOG.md only
- Report validation failures in PR comment instead of swallowing them
- Use chore: prefix for automated commit message
- Add concurrency group to prevent racing on duplicate triggers
- Add if: always() to comment step so users always get feedback
- Add comment explaining branch checkout purpose
- Remove -A flag from git add (only staging tracked CHANGELOG.md files)
- Improve step name and commit message for clarity
- Add pull_request opened trigger for release/* branches targeting main
- Use github.event.issue.number || github.event.pull_request.number for both triggers
- Conditionally show reaction only for comment triggers
- Rename file from fix-changelogs.yml to update-changelogs.yml
- Update workflow name, job names, and concurrency group
- Rename bot command to @metamaskbot update-changelogs
- Add git fetch before branch checkout (shallow clone has no branch refs)
- Handle partial fix case: report remaining errors when fixes are pushed
- Handle skipped steps: detect when earlier steps fail and report accurately
- Rename job ID from fix-changelogs to update-changelogs for consistency
@cryptodev-2s cryptodev-2s force-pushed the feat/auto-changelog-check-deps branch from 772928a to f4aabbb Compare April 14, 2026 13:58
Comment thread .github/workflows/update-changelogs.yml
Shallow clone with fetch-depth: 1 doesn't include origin/main,
causing --checkDeps to fail with "could not resolve base branch".
- Use fetch-depth: 0 so git merge-base can find common ancestor with main
- Hide previous bot comments on rerun to reduce noise
- Add emoji to comment messages for clarity
- Add --paginate to handle PRs with many comments
- Use precise emoji-anchored regex to match only this workflow's comments
- Add continue-on-error so comment hiding doesn't block core workflow
Comment thread .github/workflows/update-changelogs.yml Outdated
Use patroll-managed PAT so commits pushed by this workflow trigger
subsequent CI workflows (GITHUB_TOKEN commits don't trigger workflows).

Depends on: MetaMask/patroll#75
Comment thread .github/workflows/update-changelogs.yml Outdated
MetaMask/action-checkout-and-setup doesn't accept a token input,
so the PAT was silently ignored. Use actions/checkout with the PAT
first, then gh pr checkout, then action-checkout-and-setup for
node/yarn setup (it skips checkout if .git already exists).
Comment on lines +93 to +102
- name: Validate and fix dependency bump entries
id: validate
run: >
yarn workspaces foreach --all --no-private --parallel --interlaced --verbose
run changelog:validate --checkDeps --fix --currentPr "$PR_NUMBER"
continue-on-error: true
env:
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}

- name: Commit and push if changed
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mitigated by the is-fork-pull-request job which checks isCrossRepository before the update-changelogs job runs. The job only executes when IS_FORK == 'false', preventing untrusted fork code from being checked out with the PAT. This is the same pattern used by the update-lavamoat-policies workflow in metamask-extension.

Comment thread .github/workflows/update-changelogs.yml Outdated
- Remove unused "Get PR head ref" step (gh pr checkout handles it)
- Simplify comment-hiding regex to ^(✅|⚠️|❌) to match all 6 variants
- Set GITHUB_TOKEN and PR_NUMBER at job level to reduce repetition
- Remove per-step env overrides that are now inherited
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0959ecc. Configure here.

- name: Commit and push if changed
id: commit
run: |
if git diff --quiet; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unscoped git diff mismatches scoped git add path

Medium Severity

git diff --quiet checks ALL tracked files for changes, but git add -- '**/CHANGELOG.md' only stages changelog files. If a preceding step (e.g., yarn install via action-checkout-and-setup) modifies any other tracked file like yarn.lock, the diff detects changes, but nothing gets staged, so git commit fails. This produces a misleading "❌ Failed to push changelog fixes" comment when no changelog fixes were actually needed. The diff check needs to be scoped to the same pathspec: git diff --quiet -- '**/CHANGELOG.md'.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0959ecc. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants