Skip to content

Update devdocs-notify.yml #7

Update devdocs-notify.yml

Update devdocs-notify.yml #7

name: DevDocs PR or Issue Creation Notifier
on:
pull_request_target:
types: [opened]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Slack Notification
env:
# Use the correct 'pull_request' context
PR_TITLE: ${{ github.event.pull_request.title }}
PR_USER: ${{ github.event.pull_request.user.login }}
PR_URL: ${{ github.event.pull_request.html_url }}
REPO_NAME: ${{ github.repository }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
# Build the message and payload in one step
SLACK_PAYLOAD=$(jq -n \
--arg repo "$REPO_NAME" \
--arg title "$PR_TITLE" \
--arg user "$PR_USER" \
--arg url "$PR_URL" \
'{
"channel": "#docs-devdocs-notifications",
"username": "Issue Notifier",
"icon_emoji": ":mega:",
"text": "*:eyes: @DevDocs a PR was opened in * \($repo)\n*Title:* \($title)\n*By:* \($user)\n*URL:* \($url)"
}')
# Send to Slack
curl -X POST \
-H 'Content-type: application/json' \
--data "$SLACK_PAYLOAD" \
"$SLACK_WEBHOOK"