From 54c2b2f15a3dc254a710fa0f9ac903f60944c628 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:49:27 +0300 Subject: [PATCH] ci: Add GH workflow to notify about PR status changes (no-changelog) (#9880) --- .github/workflows/notify-pr-status.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/notify-pr-status.yml diff --git a/.github/workflows/notify-pr-status.yml b/.github/workflows/notify-pr-status.yml new file mode 100644 index 000000000..15672ea65 --- /dev/null +++ b/.github/workflows/notify-pr-status.yml @@ -0,0 +1,26 @@ +name: Notify PR status changed + +on: + pull_request_review: + types: [submitted, dismissed] + pull_request: + types: [closed] + +jobs: + notify: + runs-on: ubuntu-latest + if: >- + (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || + (github.event_name == 'pull_request_review' && github.event.review.state == 'dismissed') || + (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || + (github.event_name == 'pull_request' && github.event.pull_request.merged == false && github.event.action == 'closed') + steps: + - uses: fjogeleit/http-request-action@dea46570591713c7de04a5b556bf2ff7bdf0aa9c # v1 + name: Notify + env: + PR_URL: ${{ github.event.pull_request.html_url }} + with: + url: ${{ secrets.N8N_NOTIFY_PR_STATUS_CHANGED_URL }} + method: 'POST' + customHeaders: '{ "x-api-token": "${{ secrets.N8N_NOTIFY_PR_STATUS_CHANGED_TOKEN }}" }' + data: '{ "event_name": "${{ github.event_name }}", "pr_url": "${{ env.PR_URL }}", "event": ${{ toJSON(github.event) }} }'