Skip to content
Open
Prev Previous commit
Next Next commit
INFRA-3187: Code review fix
  • Loading branch information
XxdpavelxX committed Dec 10, 2025
commit c12d2b94894e025365c0f178c8bcdd68bd1b2cc4
42 changes: 42 additions & 0 deletions .github/actions/merge-previous-releases/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Merge Previous Releases
description: 'An action to merge previous release branches into a newly created release branch.'

inputs:
new-release-branch:
required: true
description: 'The newly created release branch (e.g., release/2.1.2)'
github-token:
description: 'GitHub token used for authentication.'
required: true
github-tools-repository:
description: 'The GitHub repository containing the GitHub tools. Defaults to the GitHub tools action repository, 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 }}

runs:
using: composite
steps:
- name: Checkout GitHub tools repository
uses: actions/checkout@v6
with:
repository: ${{ inputs.github-tools-repository }}
ref: ${{ inputs.github-tools-ref }}
path: ./github-tools

- name: Set Git user and email
shell: bash
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Run merge previous releases script
env:
NEW_RELEASE_BRANCH: ${{ inputs.new-release-branch }}
GITHUB_TOKEN: ${{ inputs.github-token }}
shell: bash
run: bash ./github-tools/.github/scripts/merge-previous-releases.sh

19 changes: 4 additions & 15 deletions .github/workflows/merge-previous-releases.yml
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

Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,8 @@ jobs:
fetch-depth: 0
token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}

- name: Checkout GitHub tools repository
uses: actions/checkout@v5
- 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

with:
repository: metamask/github-tools
path: ./github-tools

- name: Set Git user and email
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Run merge previous releases script
env:
NEW_RELEASE_BRANCH: ${{ inputs.new-release-branch }}
GITHUB_TOKEN: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
run: bash ./github-tools/.github/scripts/merge-previous-releases.sh
new-release-branch: ${{ inputs.new-release-branch }}
github-token: ${{ secrets.github-token || secrets.GITHUB_TOKEN }}
Loading