File tree Expand file tree Collapse file tree 9 files changed +134
-0
lines changed Expand file tree Collapse file tree 9 files changed +134
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ # See the "workflow builder" approach in https://github.com/slackapi/slack-github-action/.
3
+ name : Slack alert
4
+ description : Send an alert to a Slack channel using workflow builder
5
+ inputs :
6
+ inputs :
7
+ description : Textual representation of workflow inputs
8
+ required : false
9
+ default : " N/A"
10
+ type : string
11
+ results-url :
12
+ description : URL for workflow results
13
+ required : false
14
+ default : " N/A"
15
+ type : string
16
+ # Typically this would be a secret.
17
+ slack-webhook-url :
18
+ description : Slack workflow builder webhook URL
19
+ required : true
20
+ type : string
21
+ # Typically this would be a secret or variable.
22
+ slack-channel-id :
23
+ description : ID of Slack channel to send alert to
24
+ required : true
25
+ type : string
26
+ runs :
27
+ using : composite
28
+ steps :
29
+ - name : Send message to Slack via Workflow Builder
30
+
31
+ with :
32
+ payload : |
33
+ {
34
+ "channel-id": "${{ env.SLACK_CHANNEL_ID }}",
35
+ "inputs": "${{ env.INPUTS }}",
36
+ "message": "${{ env.MESSAGE }}",
37
+ "results-url": "${{ env.RESULTS_URL }}",
38
+ "workflow-url": "${{ env.WORKFLOW_URL }}"
39
+ }
40
+ env :
41
+ SLACK_WEBHOOK_URL : ${{ inputs.slack-webhook-url }}
42
+ SLACK_CHANNEL_ID : ${{ inputs.slack-channel-id }}
43
+ INPUTS : ${{ inputs.inputs }}
44
+ MESSAGE : GitHub Actions workflow failed :sob:
45
+ RESULTS_URL : ${{ inputs.results-url }}
46
+ WORKFLOW_URL : " ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
Original file line number Diff line number Diff line change 56
56
env :
57
57
FILTER : ${{ github.event.inputs.filter }}
58
58
CHECK_MODE : ${{ inputs.check_mode }}
59
+
60
+ - name : Send message to Slack via Workflow Builder
61
+ uses : ./.github/actions/slack-alert
62
+ with :
63
+ inputs : >-
64
+ filter: ${{ inputs.filter }}\n
65
+ kayobe_config_branch: ${{ inputs.kayobe_config_branch }}\n
66
+ check_mode: ${{ inputs.check_mode }}\n
67
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
68
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
69
+ if : failure()
Original file line number Diff line number Diff line change 46
46
env :
47
47
FILTER : ${{ github.event.inputs.filter }}
48
48
DISTROS : ${{ github.event.inputs.distros }}
49
+
50
+ - name : Send message to Slack via Workflow Builder
51
+ uses : ./.github/actions/slack-alert
52
+ with :
53
+ inputs : >-
54
+ filter: ${{ inputs.filter }}\n
55
+ distros: ${{ inputs.distros }}\n
56
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
57
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
58
+ if : failure() && github.event_name == 'push'
Original file line number Diff line number Diff line change 87
87
DISTROS : ${{ github.event.inputs.distros }}
88
88
SYNC_OLD_IMAGES : ${{ github.event.inputs.sync-old-images }}
89
89
SYNC_NEW_IMAGES : ${{ github.event.inputs.sync-new-images }}
90
+
91
+ - name : Send message to Slack via Workflow Builder
92
+ uses : ./.github/actions/slack-alert
93
+ with :
94
+ inputs : >-
95
+ filter: ${{ inputs.filter }}\n
96
+ distros: ${{ inputs.distros }}\n
97
+ sync-old-images: ${{ inputs.sync-old-images }}\n
98
+ sync-new-images: ${{ inputs.sync-new-images }}\n
99
+ sync-test-pulp: ${{ inputs.sync-test-pulp }}\n
100
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
101
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
102
+ if : failure()
Original file line number Diff line number Diff line change 15
15
python-version : 3.x
16
16
- run : pip install -r docs-requirements.txt
17
17
- run : mkdocs gh-deploy --force
18
+
19
+ - name : Send message to Slack via Workflow Builder
20
+ uses : ./.github/actions/slack-alert
21
+ with :
22
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
23
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
24
+ if : failure()
Original file line number Diff line number Diff line change 58
58
env :
59
59
FILTER : ${{ github.event.inputs.filter }}
60
60
CHECK_MODE : ${{ inputs.check_mode }}
61
+
62
+ - name : Send message to Slack via Workflow Builder
63
+ uses : ./.github/actions/slack-alert
64
+ with :
65
+ inputs : >-
66
+ filter: ${{ inputs.filter }}\n
67
+ kayobe_config_branch: ${{ inputs.kayobe_config_branch }}\n
68
+ check_mode: ${{ inputs.check_mode }}\n
69
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
70
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
71
+ if : failure()
Original file line number Diff line number Diff line change 68
68
env :
69
69
FILTER : ${{ inputs.filter }}
70
70
71
+ - name : Send message to Slack via Workflow Builder
72
+ uses : ./.github/actions/slack-alert
73
+ with :
74
+ inputs : >-
75
+ filter: ${{ inputs.filter }}\n
76
+ sync_ark: ${{ inputs.sync_ark }}\n
77
+ sync_test: ${{ inputs.sync_test }}\n
78
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
79
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
80
+ if : failure()
81
+
71
82
package-sync-test :
72
83
name : Sync package repositories in test
73
84
runs-on : arc-release-train-runner
@@ -100,3 +111,14 @@ jobs:
100
111
retry_wait_seconds : 3600
101
112
env :
102
113
FILTER : ${{ inputs.filter }}
114
+
115
+ - name : Send message to Slack via Workflow Builder
116
+ uses : ./.github/actions/slack-alert
117
+ with :
118
+ inputs : >-
119
+ filter: ${{ inputs.filter }}\n
120
+ sync_ark: ${{ inputs.sync_ark }}\n
121
+ sync_test: ${{ inputs.sync_test }}\n
122
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
123
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
124
+ if : failure()
Original file line number Diff line number Diff line change 30
30
env :
31
31
ANSIBLE_FORCE_COLOR : True
32
32
GITHUB_TOKEN : ${{secrets.repository_configuration_token}}
33
+
34
+ - name : Send message to Slack via Workflow Builder
35
+ uses : ./.github/actions/slack-alert
36
+ with :
37
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
38
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
39
+ if : failure() && github.event_name == 'push'
Original file line number Diff line number Diff line change @@ -115,3 +115,10 @@ jobs:
115
115
- name : Terraform Apply
116
116
if : github.ref == 'refs/heads/main' && github.event_name == 'push'
117
117
run : terraform apply -auto-approve -input=false
118
+
119
+ - name : Send message to Slack via Workflow Builder
120
+ uses : ./.github/actions/slack-alert
121
+ with :
122
+ slack-webhook-url : ${{ secrets.SLACK_WEBHOOK_URL }}
123
+ slack-channel-id : ${{ vars.SLACK_CHANNEL_ID }}
124
+ if : failure() && github.ref == 'refs/heads/main' && github.event_name == 'push'
You can’t perform that action at this time.
0 commit comments