diff --git a/.github/workflows/devdocs-notify.yml b/.github/workflows/devdocs-notify.yml index 91ef71e..5c94506 100644 --- a/.github/workflows/devdocs-notify.yml +++ b/.github/workflows/devdocs-notify.yml @@ -1,5 +1,5 @@ name: DevDocs PR or Issue Creation Notifier -on: +on: issues: types: [opened] pull_request: @@ -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}` + }), + });