Skip to content

Commit 714a95a

Browse files
committed
Pass job status into send-notification action
1 parent 164cef1 commit 714a95a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/actions/send-notification/action.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
webhook-url:
55
description: 'Google Chat Webhook URL'
66
required: true
7+
status:
8+
description: 'Status of the job'
9+
required: true
710
build-scan-url:
811
description: 'URL of the build scan to include in the notification'
912
run-name:
@@ -17,14 +20,14 @@ runs:
1720
echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
1821
echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV"
1922
- shell: bash
20-
if: ${{ success() }}
23+
if: ${{ inputs.status == 'success' }}
2124
run: |
2225
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
2326
- shell: bash
24-
if: ${{ failure() }}
27+
if: ${{ inputs.status == 'failure' }}
2528
run: |
2629
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
2730
- shell: bash
28-
if: ${{ cancelled() }}
31+
if: ${{ inputs.status == 'cancelled' }}
2932
run: |
30-
curl -X POST ${{ inputs.webhook-url }} -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancalled"}' || true
33+
curl -X POST ${{ inputs.webhook-url }} -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true

.github/workflows/windows-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ jobs:
5252
if: always()
5353
with:
5454
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
55+
status: ${{ job.status }}
5556
build-scan-url: ${{ steps.build.outputs.build-scan-url }}
5657
run-name: ${{ format('{0} | Windows | Java 17', github.ref_name) }}

0 commit comments

Comments
 (0)