File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
actions/send-notification Expand file tree Collapse file tree 2 files changed +33
-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
+ webhook-url :
5
+ description : ' Google Chat Webhook URL'
6
+ required : true
7
+ build-scan-url :
8
+ description : ' URL of the build scan to include in the notification'
9
+ runs :
10
+ using : composite
11
+ steps :
12
+ - shell : bash
13
+ run : |
14
+ echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
15
+ - shell : bash
16
+ if : ${{ success() }}
17
+ run : |
18
+ curl -X POST ${{ inputs.webhook-url }} -H 'Content-Type: application/json' -d '{ text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|spring-boot-${{ github.ref_name }} ${{ github.job }} was successful> ${{ env.BUILD_SCAN }}"}'
19
+ - shell : bash
20
+ if : ${{ failure() }}
21
+ run : |
22
+ curl -X POST ${{ inputs.webhook-url }} -H 'Content-Type: application/json' -d '{ text: "<users/all> *<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|spring-boot-${{ github.ref_name }} ${{ github.job }} failed>* ${{ env.BUILD_SCAN }}"}'
23
+ - shell : bash
24
+ if : ${{ cancelled() }}
25
+ run : |
26
+ curl -X POST ${{ inputs.webhook-url }} -H 'Content-Type: application/json' -d '{ text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|spring-boot-${{ github.ref_name }} ${{ github.job }} was cancalled>"}'
Original file line number Diff line number Diff line change @@ -36,10 +36,17 @@ jobs:
36
36
- name : Stop Docker service
37
37
run : Stop-Service -name Docker
38
38
- name : Build
39
+ id : build
39
40
env :
40
41
CI : ' true'
41
42
GRADLE_ENTERPRISE_URL : ' https://ge.spring.io'
42
43
GRADLE_ENTERPRISE_ACCESS_KEY : ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
43
44
GRADLE_ENTERPRISE_CACHE_USERNAME : ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
44
45
GRADLE_ENTERPRISE_CACHE_PASSWORD : ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
45
46
run : ./gradlew build
47
+ - name : Send notification
48
+ uses : ./.github/actions/send-notification
49
+ if : always()
50
+ with :
51
+ webhook-url : ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
52
+ build-scan-url : ${{ steps.build.outputs.build-scan-url }}
You can’t perform that action at this time.
0 commit comments