Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 53a05c2

Browse files
Update devdocs-notify.yml
Updated to new Variables structure
1 parent 1d9d34c commit 53a05c2

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

.github/workflows/devdocs-notify.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,23 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Check for new PR or issues
13-
uses: actions/github-script@v7
14-
with:
15-
script: |
16-
const text = context.payload.issue?.body
17-
|| context.payload.pull_request?.body
18-
|| "";
19-
20-
await fetch(process.env.SLACK_WEBHOOK_URL, {
21-
method: "POST",
22-
headers: { "Content-Type": "application/json" },
23-
body: JSON.stringify({
24-
text: `:eyes: @DevDocs a PR was opened or issue created in *${context.payload.repository.full_name}*
25-
Event: *${context.eventName}*
26-
Link: ${context.payload.comment?.html_url
27-
|| context.payload.issue?.html_url
28-
|| context.payload.pull_request?.html_url
29-
|| context.payload.review?.html_url}`
30-
}),
31-
});
3213
env:
33-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
14+
REPO_NAME: ${{ github.repository }}
15+
# Make sure this secret name matches what is in your Repo Settings
16+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
17+
run: |
18+
# Build Slack payload safely using jq
19+
SLACK_PAYLOAD=$(jq -n \
20+
--arg repo "$REPO_NAME" \
21+
'{
22+
"channel": "#docs-devdocs-notifications",
23+
"username": "Issue Notifier",
24+
"icon_emoji": ":mega:",
25+
"text": "📢 @DevDocs a PR was opened or issue created in \($repo)"
26+
}')
27+
28+
# Send to Slack
29+
curl -X POST \
30+
-H 'Content-type: application/json' \
31+
--data "$SLACK_PAYLOAD" \
32+
"$SLACK_WEBHOOK"

0 commit comments

Comments
 (0)