From ec728ccdc65ff809a2fa0fe16bc4996df69aa570 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 5 Jul 2022 18:29:23 +0200 Subject: [PATCH] workflows: migrate to triggered workflow for reacting to review comments Signed-off-by: Patrik Oldsberg --- .../workflows/pr-review-comment-trigger.yaml | 19 +++++++++++++++ .github/workflows/pr-review-comment.yaml | 24 +++++++++++++++++++ .github/workflows/pr.yaml | 3 --- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr-review-comment-trigger.yaml create mode 100644 .github/workflows/pr-review-comment.yaml diff --git a/.github/workflows/pr-review-comment-trigger.yaml b/.github/workflows/pr-review-comment-trigger.yaml new file mode 100644 index 0000000000..25475a03dc --- /dev/null +++ b/.github/workflows/pr-review-comment-trigger.yaml @@ -0,0 +1,19 @@ +# This workflow is used to trigger the "PR Review Comment" workflow. This chaining is needed +# because workflows triggered by pull_request_review_comment do not have access to secrets. + +name: PR Review Comment Trigger +on: + pull_request_review_comment: + types: + - created + +jobs: + trigger: + runs-on: ubuntu-latest + + # The "PR Review Comment" workflow will check the success status of this workflow and only mark + # the PR for re-review if this workflow was successful, which is when the author leaves a review comment. + if: github.repository == 'backstage/backstage' && github.event.comment.user.id == github.event.pull_request.user.id + + steps: + - run: echo "This PR needs another review" diff --git a/.github/workflows/pr-review-comment.yaml b/.github/workflows/pr-review-comment.yaml new file mode 100644 index 0000000000..65252bae09 --- /dev/null +++ b/.github/workflows/pr-review-comment.yaml @@ -0,0 +1,24 @@ +# This workflow is triggered by "PR Review Comment Trigger" + +name: PR Review Comment +on: + workflow_run: + workflows: [PR Review Comment Trigger] + types: + - completed + +jobs: + re-review: + runs-on: ubuntu-latest + + # The triggering workflow will report success if the PR needs re-review + if: github.repository == 'backstage/backstage' && github.event.workflow_run.conclusion == 'success' + + steps: + - uses: backstage/actions/re-review@v0.5.2 + with: + app-id: ${{ secrets.BACKSTAGE_GOALIE_APPLICATION_ID }} + private-key: ${{ secrets.BACKSTAGE_GOALIE_PRIVATE_KEY }} + installation-id: ${{ secrets.BACKSTAGE_GOALIE_INSTALLATION_ID }} + project-id: PVT_kwDOBFKqdc02LQ + issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index c8fe3e2d69..bfb5454a07 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -9,9 +9,6 @@ on: issue_comment: types: - created - pull_request_review_comment: - types: - - created jobs: sync: