Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the reusable Slack notification workflow to use step environment variables for inputs/secrets and fixes the Slack message JSON formatting so notifications post reliably.
Changes:
- Map
workflow_callinputs/secrets into stepenvvariables and reference them from the bash script. - Fix JSON payload formatting (remove invalid trailing commas) in both success and failure Slack message blocks.
- Use the token from
$SLACK_BOT_TOKENin thecurlAuthorization header.
| }') | ||
| fi | ||
| response=$(curl -s -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" ) | ||
| response=$(curl -s -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer $SLACK_BOT_TOKEN" ) |
There was a problem hiding this comment.
The Slack API call result is currently ignored: curl is run without -f and the response JSON isn’t checked for .ok == true, so this step can report success even when the notification fails. Consider at least logging Slack’s .error / non-2xx responses (and optionally failing the step) to avoid silent notification drops.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Low Risk
Small CI workflow refactor limited to Slack notification scripting; main risk is miswired env vars causing missing/incorrect Slack messages.
Overview
Refactors
.github/workflows/slack-notifications.ymlto passworkflow_callinputs andSLACK_BOT_TOKENinto the bash step viaenv, and then use those variables throughout thejqpayload construction andcurlrequest instead of inline${{ }}expressions.This also makes the bash condition use a POSIX-style string comparison (
[ "$STATUS" = "success" ]).Written by Cursor Bugbot for commit c2f050c. This will update automatically on new commits. Configure here.