TP-42918 | UITron | Streamline PR Reviews with Automated Slack Notifi… (#189)
link: https://github.com/navi-android/uitron/pull/189
This commit is contained in:
committed by
GitHub
parent
e50a3f3b44
commit
e9707c060c
37
.github/workflows/pr_review.yml
vendored
Normal file
37
.github/workflows/pr_review.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Label Triggered Workflow
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
label_triggered_job:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Check label and send Slack message
|
||||
id: check_label_and_send_slack
|
||||
run: |
|
||||
if [ "${{ github.event.label.name }}" == "Ready For Review" ]; then
|
||||
PR_URL="${{ github.event.pull_request.html_url }}"
|
||||
PR_TITLE="${{ github.event.pull_request.title }}"
|
||||
PR_BODY="${{ github.event.pull_request.body }}"
|
||||
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
|
||||
|
||||
MESSAGE="<!channel> Please review this PR"
|
||||
|
||||
# Define an array of attachments
|
||||
ATTACHMENTS="[{
|
||||
\"title\": \"$PR_TITLE\",
|
||||
\"text\": \"$PR_BODY\",
|
||||
\"author_name\": \"$PR_AUTHOR\",
|
||||
\"title_link\": \"$PR_URL\"
|
||||
}]"
|
||||
|
||||
JSON_PAYLOAD="{\"text\":\"$MESSAGE\",\"attachments\":$ATTACHMENTS}"
|
||||
|
||||
# Send the message with the attachment
|
||||
curl -X POST -H 'Content-type: application/json' --data "$JSON_PAYLOAD" "${{ secrets.SLACK_PR_STATUS_HOOK }}"
|
||||
else
|
||||
echo "Label is not Ready For Review. Skipping Slack notification."
|
||||
fi
|
||||
Reference in New Issue
Block a user