diff --git a/.github/workflows/slack-notify-doc-review.yml b/.github/workflows/slack-notify-doc-review.yml new file mode 100644 index 00000000000..cc20586ee5c --- /dev/null +++ b/.github/workflows/slack-notify-doc-review.yml @@ -0,0 +1,32 @@ +name: Notify Slack on Doc Review Request + +on: + pull_request: + types: [review_requested] + +jobs: + notify-slack: + # Only run if docs-prs team was requested as reviewer + if: github.event.requested_team.slug == 'docs-prs' + runs-on: ubuntu-latest + steps: + - name: Send Slack notification + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOC_REVIEW_WEBHOOK_URL }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + LINES_CHANGED: ${{ github.event.pull_request.additions + github.event.pull_request.deletions }} + run: | + jq -n \ + --arg title "$PR_TITLE" \ + --arg url "$PR_URL" \ + --arg author "$PR_AUTHOR" \ + --arg number "$PR_NUMBER" \ + --arg lines "$LINES_CHANGED" \ + '{pr_title: $title, pr_url: $url, pr_author: $author, pr_number: $number, lines_changed: $lines}' \ + | curl -X POST "$SLACK_WEBHOOK_URL" \ + -H 'Content-Type: application/json' \ + --fail-with-body \ + -d @-