-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Summary
This PR adds Slack error notifications to the package publishing workflow. When package publishing fails, a notification is sent to Slack with details about which packages failed.
Manual Action Required
The GitHub App cannot push workflow file changes due to permission restrictions. You will need to apply the changes manually.
Changes Required
Add a new notify-error job to .github/workflows/publish-packages.yml:
- Update the header comment (line 22):
-# - SLACK_WEBHOOK_URL: For release notifications (auto mode only)
+# - SLACK_WEBHOOK_URL: For release notifications and error alerts- Add the new
notify-errorjob before thesummaryjob (around line 1255):
# ============================================================================
# NOTIFY ERROR: Slack notification for publish failures
# ============================================================================
notify-error:
name: Notify error via Slack
runs-on: ubuntu-24.04
needs: [detect, publish]
if: |
always() &&
(needs.publish.result == 'failure' ||
(needs.publish.outputs.has_failures == 'true' && needs.detect.outputs.is_dry_run != 'true'))
steps:
- uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4
- name: Send Slack error notification
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
text: "β *Package Publishing Failed*"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "β *Package Publishing Failed*\n\nOne or more packages failed to publish to npm."
- type: "section"
fields:
- type: "mrkdwn"
text: "*Branch:*\n\`${{ github.ref_name }}\`"
- type: "mrkdwn"
text: "*Trigger:*\n\`${{ github.event_name }}\`"
- type: "section"
text:
type: "mrkdwn"
text: "*Failed Packages:*\n${{ needs.publish.outputs.failed_packages || 'Unknown (check workflow logs)' }}"
- type: "section"
text:
type: "mrkdwn"
text: "*Successful Packages:*\n${{ needs.publish.outputs.successful_packages || 'None' }}"
- type: "actions"
elements:
- type: "button"
text:
type: "plain_text"
text: "View Workflow Run"
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
style: "danger"How It Works
The new notify-error job:
- Runs when the
publishjob fails OR when any packages fail to publish - Uses the existing
SLACK_WEBHOOK_URLsecret (same as success notifications) - Sends a formatted Slack message with:
- Failed and successful packages lists (JSON arrays)
- Branch and trigger information
- Direct link to workflow run for debugging
- Uses
always()to ensure it runs even when other jobs fail
Testing
To test this change:
- Apply the changes manually to the workflow file
- Trigger a publish workflow (can use dry run mode)
- Simulate a failure or wait for a natural failure to verify the notification
Linear Issue
Autonomous implementation using claude-opus-4-5-20251101
Metadata
Metadata
Assignees
Labels
No labels