From 97a808e98057d626c2f15324382e8273f9667218 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Wed, 5 Feb 2025 15:07:18 +0100 Subject: [PATCH] Update Dependabot update workflow --- .github/workflows/main.yml | 1 + .github/workflows/update-pull-request.yml | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f9b85bc87..5a4eb4d004 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,7 @@ jobs: uses: ./.github/workflows/update-pull-request.yml with: dependabot: true + pull-request: ${{ github.event.pull_request.number }} secrets: PULL_REQUEST_UPDATE_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} diff --git a/.github/workflows/update-pull-request.yml b/.github/workflows/update-pull-request.yml index 1c8423409a..0ac9919d1e 100644 --- a/.github/workflows/update-pull-request.yml +++ b/.github/workflows/update-pull-request.yml @@ -13,11 +13,15 @@ on: type: boolean required: false default: false + pull-request: + type: number + required: false + default: 0 jobs: is-fork-pull-request: name: Determine whether this issue comment was on a pull request from a fork - if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot update-pr') || inputs.dependabot == true }} + if: ${{ inputs.dependabot == true || (github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot update-pr')) }} runs-on: ubuntu-latest outputs: IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} @@ -28,7 +32,7 @@ jobs: run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} react-to-comment: name: React to the comment @@ -69,7 +73,7 @@ jobs: run: gh pr checkout "${PR_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} - name: Use Node.js uses: actions/setup-node@v4 with: @@ -92,7 +96,7 @@ jobs: run: gh pr checkout "${PR_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -121,7 +125,7 @@ jobs: run: gh pr checkout "${PR_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} - name: Restore yarn.lock uses: actions/cache/restore@v4 with: @@ -156,7 +160,7 @@ jobs: run: gh pr checkout "${PR_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} - name: Restore yarn.lock uses: actions/cache/restore@v4 with: @@ -200,7 +204,7 @@ jobs: run: gh pr checkout "${PR_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }} - PR_NUMBER: ${{ github.event.issue.number }} + PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }} - name: Configure Git run: | git config --global user.name 'MetaMask Bot'