From 35f75236b57ec02d6aefa18fc964c4ec55875da6 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Mon, 9 Mar 2026 13:14:25 -0700 Subject: [PATCH 1/2] ci: add slack failure/recovery message to release --- .github/workflows/release.yaml | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b59fac423..eac6eb130 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,6 +60,82 @@ jobs: files: | archives/**/* dist/**/* + # Slack notification on failure + slack-notification: + needs: + [ + verify-tag, + build, + package, + archive, + upload, + release, + ] + if: failure() + runs-on: ubuntu-latest + steps: + - name: Notify Slack of Release failure + uses: slackapi/slack-github-action@v2.1.1 + with: + webhook: ${{ secrets.SLACK_WEBHOOK }} + webhook-type: incoming-webhook + payload: | + text: ":x: Release failed for ${{ github.ref_name }}" + blocks: + - type: section + text: + type: mrkdwn + text: ":x: *Release Failed for ${{ github.ref_name }}*\n\n*Repository:* ${{ github.repository }}\n*Tag:* `${{ github.ref_name }}`\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>" + + # Slack notification when Release recovers from failure + slack-notification-resolved: + needs: + [ + verify-tag, + build, + package, + archive, + upload, + release, + ] + if: success() + runs-on: ubuntu-latest + steps: + - name: Check if previous run failed + id: check-previous + uses: actions/github-script@v8 + with: + script: | + const runs = await github.rest.actions.listWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'release.yaml', + per_page: 2, + exclude_pull_requests: true + }); + // Get the previous run (skip current run) + const previousRuns = runs.data.workflow_runs.filter(run => run.id !== context.runId); + if (previousRuns.length > 0) { + const previousRun = previousRuns[0]; + console.log(`Previous run conclusion: ${previousRun.conclusion}`); + return previousRun.conclusion === 'failure'; + } + return false; + result-encoding: string + - name: Notify Slack of Release recovery + if: steps.check-previous.outputs.result == 'true' + uses: slackapi/slack-github-action@v2.1.1 + with: + webhook: ${{ secrets.SLACK_WEBHOOK }} + webhook-type: incoming-webhook + payload: | + text: ":white_check_mark: Release recovered for ${{ github.ref_name }}" + blocks: + - type: section + text: + type: mrkdwn + text: ":white_check_mark: *Release Recovered for ${{ github.ref_name }}*\n\n*Repository:* ${{ github.repository }}\n*Tag:* `${{ github.ref_name }}`\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>" + notify-slack: runs-on: ubuntu-latest needs: From b1b6d6f816b9464d1c7f3968d2b163af42351cc9 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Mon, 9 Mar 2026 13:18:16 -0700 Subject: [PATCH 2/2] Format --- .github/workflows/release.yaml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eac6eb130..ba967a8c7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,15 +62,7 @@ jobs: dist/**/* # Slack notification on failure slack-notification: - needs: - [ - verify-tag, - build, - package, - archive, - upload, - release, - ] + needs: [verify-tag, build, package, archive, upload, release] if: failure() runs-on: ubuntu-latest steps: @@ -89,15 +81,7 @@ jobs: # Slack notification when Release recovers from failure slack-notification-resolved: - needs: - [ - verify-tag, - build, - package, - archive, - upload, - release, - ] + needs: [verify-tag, build, package, archive, upload, release] if: success() runs-on: ubuntu-latest steps: