mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
34 lines
1.6 KiB
YAML
34 lines
1.6 KiB
YAML
name: Send Notification
|
|
description: Sends a Google Chat message as a notification of the job's outcome
|
|
inputs:
|
|
webhook-url:
|
|
description: 'Google Chat Webhook URL'
|
|
required: true
|
|
status:
|
|
description: 'Status of the job'
|
|
required: true
|
|
build-scan-url:
|
|
description: 'URL of the build scan to include in the notification'
|
|
run-name:
|
|
description: 'Name of the run to include in the notification'
|
|
default: ${{ format('{0} {1}', github.ref_name, github.job) }}
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- shell: bash
|
|
run: |
|
|
echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
|
|
echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV"
|
|
- shell: bash
|
|
if: ${{ inputs.status == 'success' }}
|
|
run: |
|
|
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
|
|
- shell: bash
|
|
if: ${{ inputs.status == 'failure' }}
|
|
run: |
|
|
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
|
|
- shell: bash
|
|
if: ${{ inputs.status == 'cancelled' }}
|
|
run: |
|
|
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true
|