Skip to content

chore: reintroduce slack notif#802

Merged
gbotrel merged 1 commit intomasterfrom
chore/slack
Feb 10, 2026
Merged

chore: reintroduce slack notif#802
gbotrel merged 1 commit intomasterfrom
chore/slack

Conversation

@gbotrel
Copy link
Copy Markdown
Collaborator

@gbotrel gbotrel commented Feb 10, 2026

Note

Low Risk
CI-only changes that add outbound Slack messaging; risk is mainly misconfiguration/noise or leaking metadata to Slack, not code/runtime behavior.

Overview
Reintroduces Slack notifications for CI by adding a reusable workflow, .github/workflows/slack-notifications.yml, that posts a success/failure message (with repo/branch/actor/run link) to the team-gnark-build channel using SLACK_BOT_TOKEN.

Updates the pr and push workflows to run a new slack-notification job always after staticcheck and test, computing a combined status from those jobs. Minor whitespace-only cleanup in pr.yml test commands.

Written by Cursor Bugbot for commit b19a2e6. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings February 10, 2026 23:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reintroduces Slack notifications for CI results by adding a reusable workflow that posts to Slack and wiring it into both the push and PR workflows.

Changes:

  • Added a reusable workflow_call workflow to post success/failure messages to Slack.
  • Added a slack-notification job to push.yml and pr.yml that runs always() and reports the combined outcome of staticcheck + test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/slack-notifications.yml New reusable workflow that builds a Slack message payload via jq and posts to chat.postMessage.
.github/workflows/push.yml Calls the reusable Slack workflow after staticcheck and the matrix test job.
.github/workflows/pr.yml Calls the reusable Slack workflow after staticcheck and test on PRs.

Comment on lines +41 to +47
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_green_circle: *All checks have passed:* *\($branch)* :white_check_mark:"
},
},
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jq filter string contains trailing commas after the first block object (after the closing brace of the section block). jq's JSON/object syntax does not allow trailing commas, so payload construction will fail and the step may silently proceed with an empty/invalid payload.

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +70
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":red_circle: *Failed run:* *\($branch)*"
},
},
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue in the failure payload: there's a trailing comma after the section block object. This makes the jq filter invalid and will prevent building the Slack message payload.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +84
run: |
if [ "${{ inputs.status }}" == "success" ]; then
payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{
"channel": "team-gnark-build",
"text": "GitHub Action build result: success",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_green_circle: *All checks have passed:* *\($branch)* :white_check_mark:"
},
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "\($repository) -- \($actor) -- <https://github.com/\($repository)/actions/runs/\($run_id)|View details>"
}
]
}
]
}')
else
payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{
"channel": "team-gnark-build",
"text": "GitHub Action build result: failure",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":red_circle: *Failed run:* *\($branch)*"
},
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "\($repository) -- \($actor) -- <https://github.com/\($repository)/actions/runs/\($run_id)|View details>"
}
]
}
]
}')
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 }}" )
shell: bash
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script doesn't enable set -e/-o pipefail or validate the Slack API response. As written, jq/curl failures (or Slack returning { "ok": false }) can be ignored and the workflow will still report success, making notifications flaky and hard to debug. Consider failing fast on jq/curl errors and at least checking/logging response.ok/response.error from the Slack API (or explicitly mark this job continue-on-error if notification failures shouldn't fail CI).

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +7
secrets:
SLACK_BOT_TOKEN:
required: true
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring SLACK_BOT_TOKEN as required: true for this reusable workflow will cause pull_request workflows from forks to fail at workflow-call time (fork PRs don't get repository secrets). Either make this secret optional and no-op when it's missing, or ensure callers add an if: guard to skip notifications for forked PRs.

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +79
slack-notification:
needs: [staticcheck, test]
if: always()
uses: ./.github/workflows/slack-notifications.yml
with:
status: ${{ (needs.staticcheck.result == 'success' && needs.test.result == 'success') && 'success' || 'failure' }}
actor: ${{ github.actor }}
repository: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
run_id: ${{ github.run_id }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job always runs on pull_request, but SLACK_BOT_TOKEN won't be available for PRs from forks, and the reusable workflow currently requires it. That will make forked PR checks fail. Add an if: guard to skip on forked PRs (e.g., when github.event.pull_request.head.repo.full_name != github.repository) and/or adjust the reusable workflow secret requirement to be optional with a graceful no-op.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

"type": "mrkdwn",
"text": ":large_green_circle: *All checks have passed:* *\($branch)* :white_check_mark:"
},
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing commas in jq expressions break Slack notifications

High Severity

The jq -n object construction has a trailing comma after the "text" inner object closes (before the section object closes). jq does not allow trailing commas and will fail with a syntax error. This affects both the success and failure payload branches, meaning Slack notifications will never be sent. Since GitHub Actions bash steps default to set -eo pipefail, the jq failure will cause the entire step to error out.

Additional Locations (1)

Fix in Cursor Fix in Web

@gbotrel gbotrel merged commit 4abc1c1 into master Feb 10, 2026
20 checks passed
@gbotrel gbotrel deleted the chore/slack branch February 10, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants