|
17 | 17 | description: Whether to notify the user of the health check outcome
|
18 | 18 | type: boolean
|
19 | 19 | required: false
|
| 20 | + slack_channel: |
| 21 | + description: The Slack channel to send notifications to |
| 22 | + type: string |
| 23 | + required: false |
20 | 24 | secrets:
|
21 | 25 | SLACK_TOKEN:
|
22 | 26 | description: The Slack token to use for notifications
|
|
37 | 41 | description: Whether to notify the user of the health check outcome
|
38 | 42 | type: boolean
|
39 | 43 | required: false
|
| 44 | + slack_channel: |
| 45 | + description: The Slack channel to send notifications to |
| 46 | + type: string |
| 47 | + required: false |
40 | 48 |
|
41 | 49 | env:
|
42 | 50 | health_check_file: health_check.json
|
|
46 | 54 | context:
|
47 | 55 | runs-on: ubuntu-latest
|
48 | 56 | outputs:
|
| 57 | + slack_channel: ${{ steps.environment.outputs.slack_channel }} |
49 | 58 | notify: ${{ steps.environment.outputs.notify }}
|
50 | 59 | environment: ${{ steps.environment.outputs.environment }}
|
51 | 60 |
|
|
55 | 64 | env:
|
56 | 65 | notify: ${{ inputs.notify }}
|
57 | 66 | environment: ${{ inputs.environment }}
|
| 67 | + slack_channel: ${{ inputs.slack_channel }} |
58 | 68 | run: |
|
59 | 69 | if [[ "$environment" == "prod" ]]; then
|
60 | 70 | environment="prod"
|
|
66 | 76 | environment="host"
|
67 | 77 | fi
|
68 | 78 |
|
69 |
| - echo "notify=$notify" >> "$GITHUB_OUTPUT" |
70 |
| - echo "environment=$environment" >> "$GITHUB_OUTPUT" |
| 79 | + { |
| 80 | + echo "notify=$notify" |
| 81 | + echo "slack_channel=$slack_channel" |
| 82 | + echo "environment=$environment" |
| 83 | + } >> "$GITHUB_OUTPUT" |
71 | 84 | cat "$GITHUB_OUTPUT"
|
72 | 85 |
|
73 | 86 | health_check:
|
@@ -125,13 +138,13 @@ jobs:
|
125 | 138 | cat "$GITHUB_OUTPUT"
|
126 | 139 |
|
127 | 140 | - name: Notify Failure
|
128 |
| - if: steps.blocks.outcome == 'success' |
| 141 | + if: steps.blocks.outcome == 'success' && needs.context.outputs.slack_channel != '' |
129 | 142 | uses: mozilla/addons/.github/actions/slack@aa3c320008a837a8faa40badb88006421f63efdb
|
130 | 143 | with:
|
131 | 144 | slack_token: ${{ secrets.SLACK_TOKEN }}
|
132 | 145 | payload: |
|
133 | 146 | {
|
134 |
| - "channel": "${{ vars.SLACK_ADDONS_PRODUCTION_CHANNEL }}", |
| 147 | + "channel": "${{ needs.context.outputs.slack_channel }}", |
135 | 148 | "blocks": ${{ toJson(steps.blocks.outputs.blocks) }},
|
136 | 149 | "text": "[${{ needs.context.outputs.environment }}] Health check ${{ steps.health_check.outcome }}",
|
137 | 150 | # Don't unfurl links or media
|
|
0 commit comments