[Bug]: Incorrect event logged for Swap operation from USDC to SOL #22354
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 my PR | |
| on: | |
| # Trigger the workflow when a comment is created on an issue or pull request | |
| issue_comment: | |
| types: [created] | |
| env: | |
| VERSION_BUMP_HEAD_BRANCH_PATTERN: '^version-bump/[0-9]+\.[0-9]+\.[0-9]+$' | |
| STABLE_MAIN_HEAD_BRANCH_PATTERN: '^stable-main-[0-9]+\.[0-9]+\.[0-9]+$' | |
| STABLE_SYNC_HEAD_BRANCH_PATTERN: '^stable-sync-' | |
| RELEASE_BASE_BRANCH_PATTERN: '^release/[0-9]+\.[0-9]+\.[0-9]+$' | |
| jobs: | |
| merge-my-pr: | |
| # Only run if the comment is on a PR and the comment body matches exactly "Merge my PR" | |
| 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 | |
| environment: default-branch | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| # Fetch PR metadata (head branch) using the GitHub API | |
| - name: Get PR Details | |
| uses: actions/github-script@v7 | |
| env: | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| // Fetch full details of the pull request associated with the comment | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: parseInt(process.env.PR_NUMBER, 10), | |
| }); | |
| // Export head/base refs for subsequent steps | |
| core.exportVariable('PR_HEAD_REF', pr.head.ref); | |
| core.exportVariable('PR_BASE_REF', pr.base.ref); | |
| - name: Check the branch name against patterns | |
| id: check-branch | |
| run: | | |
| if [[ "${PR_HEAD_REF}" =~ ${VERSION_BUMP_HEAD_BRANCH_PATTERN} ]]; then | |
| echo "Branch name matches version bump pattern" | |
| echo "version-bump=true" >> "$GITHUB_OUTPUT" | |
| elif [[ "${PR_HEAD_REF}" =~ ${STABLE_MAIN_HEAD_BRANCH_PATTERN} ]]; then | |
| echo "Branch name matches stable main pattern" | |
| echo "stable-main=true" >> "$GITHUB_OUTPUT" | |
| elif [[ "${PR_HEAD_REF}" =~ ${STABLE_SYNC_HEAD_BRANCH_PATTERN} ]] && [[ "${PR_BASE_REF}" =~ ${RELEASE_BASE_BRANCH_PATTERN} ]]; then | |
| echo "Branch name matches stable-sync -> release pattern" | |
| echo "stable-sync-release=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Merge approved version bump PR | |
| if: ${{ steps.check-branch.outputs.version-bump == 'true' }} | |
| uses: MetaMask/github-tools/.github/actions/merge-approved-pr@v1 | |
| with: | |
| pr-number: ${{ github.event.issue.number }} | |
| # Merge PRs from version-bump/X.Y.Z into main | |
| required-base-branch: 'main' | |
| head-branch-pattern: '^version-bump/[0-9]+\.[0-9]+\.[0-9]+$' | |
| merge-method: 'squash' | |
| verify-version-bump: true | |
| github-token: ${{ secrets.METAMASK_EXTENSION_BRANCH_SYNC_TOKEN }} | |
| - name: Merge approved stable main PR | |
| if: ${{ steps.check-branch.outputs.stable-main == 'true' }} | |
| uses: MetaMask/github-tools/.github/actions/merge-approved-pr@v1 | |
| with: | |
| pr-number: ${{ github.event.issue.number }} | |
| # Merge PRs from stable-main-X.Y.Z into main | |
| required-base-branch: 'main' | |
| head-branch-pattern: '^stable-main-[0-9]+\.[0-9]+\.[0-9]+$' | |
| merge-method: 'merge' | |
| github-token: ${{ secrets.METAMASK_EXTENSION_BRANCH_SYNC_TOKEN }} | |
| - name: Merge approved stable-sync to release PR | |
| if: ${{ steps.check-branch.outputs.stable-sync-release == 'true' }} | |
| uses: MetaMask/github-tools/.github/actions/merge-approved-pr@v1 | |
| with: | |
| pr-number: ${{ github.event.issue.number }} | |
| required-base-branch: ${{ env.PR_BASE_REF }} | |
| head-branch-pattern: '^stable-sync-' | |
| merge-method: 'merge' | |
| github-token: ${{ secrets.METAMASK_EXTENSION_BRANCH_SYNC_TOKEN }} |