37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: PR Label CI
|
|
|
|
on:
|
|
pull_request:
|
|
types: [ labeled ]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
pr-label:
|
|
if: github.event.label.name == 'Ready For Review'
|
|
runs-on: [ default ]
|
|
steps:
|
|
- name: Check label and send Slack message
|
|
run: |
|
|
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="<!here> 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 }}"
|