Create devdocs-notify.yml for when a PR is created #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DevDocs PR or Issue Creation Notifier | |
on: | |
pull_request: | |
types: [opened] | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for new PR or issues | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const text = context.payload.comment?.body | |
|| context.payload.issue?.body | |
|| context.payload.pull_request?.body | |
|| context.payload.review?.body | |
|| ""; | |
await fetch(process.env.SLACK_WEBHOOK_URL, { | |
method: "POST", | |
headers: { "Content-Type": "application/json" }, | |
body: JSON.stringify({ | |
text: `:eyes: @DevDocs a PR was opened in *${context.payload.repository.full_name}* | |
Event: *${context.eventName}* | |
Link: ${context.payload.comment?.html_url | |
|| context.payload.issue?.html_url | |
|| context.payload.pull_request?.html_url | |
|| context.payload.review?.html_url}` | |
}), | |
}); | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |