From 31912e97b29cfea86bcbc4c5d738ab8025c020b4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 18 Sep 2020 21:08:40 +0200 Subject: [PATCH] Switch to other rebase action. (#89538) --- .github/workflows/dispatch-command.yml | 17 ++++++++++++ .github/workflows/rebase.yml | 36 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/dispatch-command.yml diff --git a/.github/workflows/dispatch-command.yml b/.github/workflows/dispatch-command.yml new file mode 100644 index 0000000000..273b318288 --- /dev/null +++ b/.github/workflows/dispatch-command.yml @@ -0,0 +1,17 @@ +name: Dispatch Command + +on: + issue_comment: + types: [created] + +jobs: + dispatch-command: + runs-on: ubuntu-latest + steps: + - name: Dispatch /rebase Command + uses: peter-evans/slash-command-dispatch@7dd4ee1aa3be41c206a08dba4fa0c486cfd595ee + with: + token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + commands: rebase + permission: triage + issue-type: pull-request diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index d3b1cce7d3..c1846a171c 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -1,21 +1,35 @@ name: Rebase Pull Request on: - issue_comment: - types: [created] + repository_dispatch: + types: [rebase-command] jobs: rebase_pull_request: name: Rebase Pull Request - if: github.event.issue.pull_request != '' && github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '@BrewTestBot rebase') runs-on: ubuntu-latest steps: - - name: Checkout Pull Request - uses: actions/checkout@v2 - with: - fetch-depth: 0 - persist-credentials: false - name: Rebase Pull Request - uses: cirrus-actions/rebase@b91cdc98c0c0d3c4673647a74a68731bf3c29276 - env: - GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + uses: peter-evans/rebase@4a740021d5fa2d93c53642380fde7f28b08a1fcf + id: rebase + with: + token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + head: ${{ github.event.client_payload.pull_request.head.label }} + + - name: Add 👍 Reaction + if: always() && steps.rebase.outputs.rebased-count == 1 + uses: peter-evans/create-or-update-comment@41f3207a84f33bd70388036109082784d059dcaa + with: + token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + reaction-type: '+1' + + - name: Add 👎 Reaction + if: always() && steps.rebase.outputs.rebased-count != 1 + uses: peter-evans/create-or-update-comment@41f3207a84f33bd70388036109082784d059dcaa + with: + token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + repository: ${{ github.event.client_payload.github.payload.repository.full_name }} + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + reaction-type: '-1'