Skip to content

[DEV-169] Implementation: Add Slack error notifications for package publishingΒ #265

@claude

Description

@claude

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:

  1. Update the header comment (line 22):
-# - SLACK_WEBHOOK_URL: For release notifications (auto mode only)
+# - SLACK_WEBHOOK_URL: For release notifications and error alerts
  1. Add the new notify-error job before the summary job (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 publish job fails OR when any packages fail to publish
  • Uses the existing SLACK_WEBHOOK_URL secret (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:

  1. Apply the changes manually to the workflow file
  2. Trigger a publish workflow (can use dry run mode)
  3. Simulate a failure or wait for a natural failure to verify the notification

Linear Issue

Closes: https://linear.app/uniswap/issue/DEV-169/add-slack-error-notifications-to-package-publishing-workflow


Autonomous implementation using claude-opus-4-5-20251101

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions