Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions .github/workflows/devdocs-notify.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: DevDocs PR or Issue Creation Notifier
on:
on:
issues:
types: [opened]
pull_request:
Expand All @@ -8,28 +8,25 @@ on:
jobs:
notify:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Debug Slack URL
run: echo "Webhook=${SLACK_WEBHOOK_URL}"

- 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
|| "";
const url = process.env.SLACK_WEBHOOK_URL;
console.log("Slack URL (first 10 chars):", url?.substring(0, 10));

await fetch(process.env.SLACK_WEBHOOK_URL, {
await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `:eyes: @DevDocs a PR was opened or issue created 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 }}
text: `:eyes: @DevDocs a PR was opened or issue created in *${context.payload.repository.full_name}*
Event: *${context.eventName}*
Link: ${context.payload.pull_request?.html_url || context.payload.issue?.html_url}`
}),
});