File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
actions/send-notification Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Send Notification
2+ description : ' Sends a Google Chat message as a notification of the job'' s outcome'
3+ inputs :
4+ build-scan-url :
5+ description : ' URL of the build scan to include in the notification'
6+ required : false
7+ run-name :
8+ description : ' Name of the run to include in the notification'
9+ required : false
10+ default : ${{ format('{0} {1}', github.ref_name, github.job) }}
11+ status :
12+ description : ' Status of the job'
13+ required : true
14+ webhook-url :
15+ description : ' Google Chat Webhook URL'
16+ required : true
17+ runs :
18+ using : composite
19+ steps :
20+ - name : Prepare Variables
21+ shell : bash
22+ run : |
23+ echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
24+ echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV"
25+ - name : Success Notification
26+ if : ${{ inputs.status == 'success' }}
27+ shell : bash
28+ run : |
29+ curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was successful ${{ env.BUILD_SCAN }}"}' || true
30+ - name : Failure Notification
31+ if : ${{ inputs.status == 'failure' }}
32+ shell : bash
33+ run : |
34+ curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<users/all> *<${{ env.RUN_URL }}|${{ inputs.run-name }}> failed* ${{ env.BUILD_SCAN }}"}' || true
35+ - name : Cancel Notification
36+ if : ${{ inputs.status == 'cancelled' }}
37+ shell : bash
38+ run : |
39+ curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true
Original file line number Diff line number Diff line change 6262 context-path : /
6363 cloudflare-zone-id : ${{ secrets.CLOUDFLARE_ZONE_ID }}
6464 cloudflare-cache-token : ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
65+ - name : Send Notification
66+ if : failure()
67+ uses : ./.github/actions/send-notification
68+ with :
69+ run-name : ${{ format('{0} | Build and Deploy Docs', github.ref_name) }}
70+ status : ${{ job.status }}
71+ webhook-url : ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
You can’t perform that action at this time.
0 commit comments