1111 generate_docs_new_pr :
1212 if : ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
1313 runs-on : ubuntu-latest
14+ environment : integration
1415 permissions :
1516 id-token : write
1617 contents : read
@@ -108,7 +109,10 @@ jobs:
108109
109110 - name : Remove costs before committing
110111 shell : bash
111- run : rm -rf costs
112+ run : |
113+ rm -rf costs
114+ # remove after testing
115+ exit 1
112116
113117 - name : Setup GitHub Token for creating a new PR
114118 id : setup-github-token-write
@@ -127,3 +131,57 @@ jobs:
127131 title : " Go docs for PR#${{ github.event.pull_request.number }}"
128132 body : " This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
129133 commit-message : " [Bot] Add automatically generated go documentation"
134+
135+ - name : Send Slack notification
136+ uses : slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
137+ if : failure() || cancelled()
138+ id : slack
139+ env :
140+ SLACK_BOT_TOKEN : ${{ secrets.QA_SLACK_API_KEY }}
141+ with :
142+ channel-id : ' C049X3353K2'
143+ payload : |
144+ {
145+ "attachments": [
146+ {
147+ "color": "${{ contains(join(needs.*.result, ','), 'failure') && '#C62828' || contains(join(needs.*.result, ','), 'cancelled') && '#FFA000' || '2E7D32' }}",
148+ "blocks": [
149+ {
150+ "type": "section",
151+ "text": {
152+ "type": "mrkdwn",
153+ "text": "Go doc generation - ${{ contains(join(needs.*.result, ','), 'failure') && 'Failed :x:' || contains(join(needs.*.result, ','), 'cancelled') && 'Cancelled :warning:' }}"
154+ }
155+ },
156+ {
157+ "type": "section",
158+ "text": {
159+ "type": "mrkdwn",
160+ "text": "${{ github.ref_name }} | <${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>"
161+ }
162+ }
163+ ]
164+ }
165+ ]
166+ }
167+
168+ - name : Notify user in Slack message if tests failed
169+ if : failure() || cancelled()
170+ uses : slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
171+ env :
172+ SLACK_BOT_TOKEN : ${{ secrets.QA_SLACK_API_KEY }}
173+ with :
174+ channel-id : ' C049X3353K2'
175+ payload : |
176+ {
177+ "thread_ts": "${{ steps.slack.outputs.thread_ts }}",
178+ "blocks": [
179+ {
180+ "type": "section",
181+ "text": {
182+ "type": "mrkdwn",
183+ "text": "Notifying <@U060CGGPY8H>, please check doc generation log."
184+ }
185+ }
186+ ]
187+ }
0 commit comments