Skip to content

Commit 36b17c9

Browse files
committed
Send notification when a test passes unexpectedly
Closes gh-66
1 parent ae58a5f commit 36b17c9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ inputs:
1313
webhook-url:
1414
description: 'Google Chat Webhook URL'
1515
required: true
16+
outcome-description:
17+
required: false
18+
default: 'failed'
1619
runs:
1720
using: composite
1821
steps:
1922
- shell: bash
2023
run: |
21-
curl -s -o /dev/null -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<users/all> ${{ inputs.task }} <${{ inputs.failure-url }}|failed> on ${{ inputs.branch }} "}' || true
24+
curl -s -o /dev/null -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<users/all> ${{ inputs.task }} <${{ inputs.failure-url }}|${{ inputs.outcome-description }}> on ${{ inputs.branch }} "}' || true

.github/workflows/smoke-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,17 @@ jobs:
5252
continue-on-error: ${{ inputs.expected_to_fail }}
5353
- name: Check Out Send Notification Action
5454
uses: actions/checkout@v4
55-
if: ${{ failure() }}
55+
if: ${{ failure() || (steps.build.outcome == 'success' && inputs.expected_to_fail)}}
5656
with:
5757
path: ci
5858
ref: ci
5959
sparse-checkout: .github/actions/send-notification
6060
- name: Send notification
6161
uses: ./ci/.github/actions/send-notification
62-
if: ${{ failure() }}
62+
if: ${{ failure() || (steps.build.outcome == 'success' && inputs.expected_to_fail)}}
6363
with:
6464
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
6565
task: ${{ inputs.project }}:${{ inputs.task }}
6666
branch: ${{ inputs.checkout_ref }}
6767
failure-url: ${{ steps.build.outputs.build-scan-url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
68+
outcome-description: ${{ inputs.expected_to_fail && 'passed unexpectedly' || 'failed' }}

gradle/plugins/lifecycle-smoke-test-ci-plugin/src/main/resources/smoke-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,17 @@ jobs:
5252
continue-on-error: ${{ inputs.expected_to_fail }}
5353
- name: Check Out Send Notification Action
5454
uses: actions/checkout@v4
55-
if: ${{ failure() }}
55+
if: ${{ failure() || (steps.build.outcome == 'success' && inputs.expected_to_fail)}}
5656
with:
5757
path: ci
5858
ref: ci
5959
sparse-checkout: .github/actions/send-notification
6060
- name: Send notification
6161
uses: ./ci/.github/actions/send-notification
62-
if: ${{ failure() }}
62+
if: ${{ failure() || (steps.build.outcome == 'success' && inputs.expected_to_fail)}}
6363
with:
6464
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
6565
task: ${{ inputs.project }}:${{ inputs.task }}
6666
branch: ${{ inputs.checkout_ref }}
6767
failure-url: ${{ steps.build.outputs.build-scan-url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
68+
outcome-description: ${{ inputs.expected_to_fail && 'passed unexpectedly' || 'failed' }}

0 commit comments

Comments
 (0)