42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
|
name: Send Slack alert on PR merge test failure
|
||
|
description: Send a Slack alert when automated tests failed on trunk after PR merge.
|
||
|
permissions: {}
|
||
|
|
||
|
inputs:
|
||
|
slack-bot-token:
|
||
|
required: true
|
||
|
channel-id:
|
||
|
required: true
|
||
|
test-type:
|
||
|
required: true
|
||
|
type: choice
|
||
|
options:
|
||
|
- E2E
|
||
|
- API
|
||
|
- k6
|
||
|
|
||
|
runs:
|
||
|
using: composite
|
||
|
steps:
|
||
|
- name: Compose Slack message
|
||
|
id: compose-slack-message
|
||
|
uses: actions/github-script@v6
|
||
|
env:
|
||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||
|
SHA: ${{ github.event.pull_request.merge_commit_sha }}
|
||
|
TEST_TYPE: ${{ inputs.test-type }}
|
||
|
with:
|
||
|
script: |
|
||
|
const script = require('./.github/actions/tests/slack-alert-on-pr-merge/scripts/compose-slack-message.js')
|
||
|
const slackMessage = script()
|
||
|
core.setOutput('slack-message', slackMessage)
|
||
|
|
||
|
- name: Send Slack alert
|
||
|
uses: slackapi/slack-github-action@v1.23.0
|
||
|
env:
|
||
|
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
|
||
|
with:
|
||
|
channel-id: ${{ inputs.channel-id }}
|
||
|
payload: ${{ steps.compose-slack-message.outputs.slack-message }}
|