Skip to content

Conversation

@XxdpavelxX
Copy link
Contributor

@XxdpavelxX XxdpavelxX commented Dec 8, 2025


Note

Adds a composite GitHub Action and script to auto-merge older release branches into a new release branch, favoring the destination on conflicts and pushing if changes occur.

  • CI/CD:
    • New composite action /.github/actions/merge-previous-releases/action.yml:
      • Inputs: new-release-branch, github-token, optional github-tools-repository, github-tools-ref.
      • Checks out target release branch and tools repo; sets git user; runs merge script.
    • New script /.github/scripts/merge-previous-releases.sh:
      • Parses release/X.Y.Z versions, finds all older release branches, sorts them, and merges into NEW_RELEASE_BRANCH.
      • Uses -X ours to favor destination on conflicts; skips branches already merged; resolves remaining conflicts keeping destination; commits and pushes only if merges occurred.
      • Leaves source branches open; fails fast on errors.

Written by Cursor Bugbot for commit 22f3e41. This will update automatically on new commits. Configure here.

Testing:
consensys-test/metamask-mobile-test-workflow#59

  1. Multiple branches, one already merged: https://github.com/consensys-test/metamask-mobile-test-workflow/actions/runs/20072233678
  2. Multiple branches, neither merged: https://github.com/consensys-test/metamask-mobile-test-workflow/actions/runs/20073029520
  3. Multiple branches, with merge conflicts: https://github.com/consensys-test/metamask-mobile-test-workflow/actions/runs/20073136324

@XxdpavelxX XxdpavelxX force-pushed the INFRA-3187-AutomateMergingReleaseBranches branch from 29c17fe to ed5be17 Compare December 8, 2025 20:40
@XxdpavelxX XxdpavelxX self-assigned this Dec 9, 2025
Mrtenz
Mrtenz previously requested changes Dec 10, 2025
Comment on lines 33 to 37
- name: Checkout GitHub tools repository
uses: actions/checkout@v5
with:
repository: metamask/github-tools
path: ./github-tools
Copy link
Member

Choose a reason for hiding this comment

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

This will check out the main branch of github-tools, which is prone to breaking. Please change this workflow to an action instead, and use this pattern:

github-tools-repository:
description: 'The GitHub repository containing the GitHub tools. Defaults to the GitHub tools action repositor, and usually does not need to be changed.'
required: false
default: ${{ github.action_repository }}
github-tools-ref:
description: 'The SHA of the action to use. Defaults to the current action ref, and usually does not need to be changed.'
required: false
default: ${{ github.action_ref }}

- name: Checkout GitHub tools repository
if: ${{ steps.label-check.outputs.skip_check != 'true' }}
uses: actions/checkout@v6
with:
repository: ${{ inputs.github-tools-repository }}
ref: ${{ inputs.github-tools-ref }}
path: ./.github-tools

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@XxdpavelxX XxdpavelxX requested a review from Mrtenz December 10, 2025 15:46
Copy link
Member

Choose a reason for hiding this comment

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

Is this workflow necessary now? The action can be called from other repositories directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. I removed the workflow

token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}

- name: Merge previous releases
uses: metamask/github-tools/.github/actions/merge-previous-releases@INFRA-3187-AutomateMergingReleaseBranches
Copy link

Choose a reason for hiding this comment

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

Bug: Workflow references feature branch that will be deleted

The workflow references the action using @INFRA-3187-AutomateMergingReleaseBranches, which is a feature branch name. Once this PR is merged, this branch will likely be deleted, causing the workflow to fail when it tries to fetch the action. This aligns with the reviewer comment from @Mrtenz who noted that referencing the main branch is "prone to breaking" and suggested using a proper versioning pattern with github.action_repository and github.action_ref.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was in the workflow and has been removed

@XxdpavelxX XxdpavelxX requested a review from Mrtenz December 10, 2025 16:21
Copy link
Member

@Mrtenz Mrtenz left a comment

Choose a reason for hiding this comment

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

Action looks good to me. I don't have context on the script itself, so will let someone else review that!

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.

3 participants