Merge Stable Sync Release PR #2447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Merge Stable Sync Release PR | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| prepare-stable-sync-release-merge: | |
| name: Validate stable-sync → release PR for merge | |
| if: >- | |
| github.event.issue.pull_request && | |
| github.event.comment.body == 'Merge my PR' && | |
| ( | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' | |
| ) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| should_merge: ${{ steps.validate.outputs.should_merge }} | |
| base_branch: ${{ steps.validate.outputs.base_branch }} | |
| steps: | |
| - name: Validate PR head/base for stable → release sync | |
| id: validate | |
| uses: actions/github-script@v9 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.issue.number; | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| }); | |
| const head = pr.head.ref; | |
| const base = pr.base.ref; | |
| // Same pairing as block-stable-sync-to-release.yml | |
| const headRe = /^stable-sync-/; | |
| const baseRe = /^release\/[0-9]+\.[0-9]+\.[0-9]+$/; | |
| if (!headRe.test(head) || !baseRe.test(base)) { | |
| core.info( | |
| `Skip: PR #${prNumber} is not stable-sync-* -> release/X.Y.Z (${head} -> ${base})`, | |
| ); | |
| core.setOutput('should_merge', 'false'); | |
| core.setOutput('base_branch', ''); | |
| return; | |
| } | |
| core.setOutput('should_merge', 'true'); | |
| core.setOutput('base_branch', base); | |
| core.info(`Validated stable sync → release merge: ${head} -> ${base}`); | |
| merge-pr: | |
| name: Merge with merge commit (via github-tools) | |
| needs: prepare-stable-sync-release-merge | |
| if: needs.prepare-stable-sync-release-merge.outputs.should_merge == 'true' | |
| uses: MetaMask/github-tools/.github/workflows/merge-approved-pr.yml@v1 | |
| with: | |
| pr-number: ${{ github.event.issue.number }} | |
| required-base-branch: ${{ needs.prepare-stable-sync-release-merge.outputs.base_branch }} | |
| head-branch-pattern: '^stable-sync-' | |
| merge-method: merge | |
| secrets: | |
| github-token: ${{ secrets.METAMASK_MOBILE_BRANCH_SYNC_TOKEN }} |