From afd3cef086a389db45d59ca67922f35119506fcc Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Fri, 19 Feb 2021 11:59:15 -0800 Subject: [PATCH] update repo sync (#17919) --- .github/allowed-actions.js | 2 +- .github/workflows/repo-sync.yml | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/allowed-actions.js b/.github/allowed-actions.js index d156603d81..f0e792dda2 100644 --- a/.github/allowed-actions.js +++ b/.github/allowed-actions.js @@ -31,7 +31,7 @@ module.exports = [ 'rachmari/actions-add-new-issue-to-column@1a459ef92308ba7c9c9dc2fcdd72f232495574a9', 'rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e', 'repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88', - 'repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d', + 'repo-sync/pull-request@65194d8015be7624d231796ddee1cd52a5023cb3', // repo-sync/pull-request@v2.6 'someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd', 'tjenkinson/gh-action-auto-merge-dependency-updates@4d7756c04d9d999c5968697a621b81c47f533d61', 'EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575', diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml index 90664d9bb5..bbdb151292 100644 --- a/.github/workflows/repo-sync.yml +++ b/.github/workflows/repo-sync.yml @@ -46,7 +46,7 @@ jobs: - name: Create pull request id: create-pull - uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d + uses: repo-sync/pull-request@65194d8015be7624d231796ddee1cd52a5023cb3 env: GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} with: @@ -66,8 +66,21 @@ jobs: base: main author: Octomerger + # Sometimes the `repo-sync` branch gets created but GitHub thinks a pull + # request is already attached to the branch. This may happen when an + # external contributor creates a pull request for the `repo-sync` branch + # in a fork, then deletes their repository. If there were changes added + # to the `repo-sync` branch but no pull request can be found, we should + # fail. The failure will then be sent to Slack in the last step. + - name: Check for pull request creation errors + if: ${{ !steps.find-pull-request.outputs.number && steps.create-pull.outputs.has_changed_files == 'true'}} + id: check-pr-creation + run: | + echo 'Unable to create a new PR for the existing branch `repo-sync`. Delete that branch and re-run this workflow to generate a new PR.' + exit 1 # prevents further steps from running + - name: Approve pull request - if: ${{ steps.find-pull-request.outputs.number }} + if: ${{ steps.find-pull-request.outputs.number}} uses: juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8 with: github-token: ${{ secrets.GITHUB_TOKEN }}