|
15 | 15 | name: Release
|
16 | 16 | runs-on: ubuntu-24.04
|
17 | 17 | strategy:
|
| 18 | + fail-fast: true |
18 | 19 | matrix:
|
19 | 20 | release:
|
20 | 21 | - release-all-in-one-nightly
|
@@ -47,13 +48,59 @@ jobs:
|
47 | 48 | slack-notify-failure:
|
48 | 49 | needs: release
|
49 | 50 | runs-on: ubuntu-24.04
|
50 |
| - if: failure() |
| 51 | + if: failure() && always() |
51 | 52 | steps:
|
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - name: Get failed jobs |
| 57 | + id: get_failed_jobs |
| 58 | + uses: actions/github-script@v7 |
| 59 | + with: |
| 60 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + script: | |
| 62 | + const response = await github.rest.actions.listJobsForWorkflowRun({ |
| 63 | + owner: context.repo.owner, |
| 64 | + repo: context.repo.repo, |
| 65 | + run_id: context.runId |
| 66 | + }); |
| 67 | +
|
| 68 | + const failedJobs = response.data.jobs |
| 69 | + .filter(job => job.status === 'completed' && job.conclusion === 'failure') |
| 70 | + .map(job => job.name) |
| 71 | + .join(', '); |
| 72 | +
|
| 73 | + core.setOutput('failed_jobs', failedJobs); |
| 74 | +
|
52 | 75 | - name: Slack Notification
|
53 | 76 | uses: 8398a7/action-slack@v3
|
54 | 77 | with:
|
55 |
| - status: ${{ job.status }} |
56 |
| - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message) |
| 78 | + status: custom |
| 79 | + fields: repo,workflow,commit,author |
| 80 | + custom_payload: | |
| 81 | + { |
| 82 | + "text": "Release Nightly Failed 😔", |
| 83 | + "attachments": [{ |
| 84 | + "color": "danger", |
| 85 | + "fields": [ |
| 86 | + { |
| 87 | + "title": "Failed Build", |
| 88 | + "value": "${{ steps.get_failed_jobs.outputs.failed_jobs }}", |
| 89 | + "short": false |
| 90 | + }, |
| 91 | + { |
| 92 | + "title": "Commit", |
| 93 | + "value": "<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>", |
| 94 | + "short": false |
| 95 | + }, |
| 96 | + { |
| 97 | + "title": "Author", |
| 98 | + "value": "${{ github.actor }}", |
| 99 | + "short": true |
| 100 | + } |
| 101 | + ] |
| 102 | + }] |
| 103 | + } |
57 | 104 | env:
|
58 | 105 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_ENG_NOTIFS }}
|
59 | 106 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
0 commit comments