ci: send slack alerts for sims only on status change (#12225)
* ci: send slack sims notification only on status change Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
parent
bfb91ab7bc
commit
748b9f08bc
36
.github/actions/last-workflow-status/action.yaml
vendored
Normal file
36
.github/actions/last-workflow-status/action.yaml
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# from https://github.com/MercymeIlya/last-workflow-status with fixes
|
||||
name: "Get status of last workflow"
|
||||
description: "Get conclusion of last workflow run on current branch."
|
||||
branding:
|
||||
icon: "arrow-left"
|
||||
color: "yellow"
|
||||
inputs:
|
||||
github_token:
|
||||
description: Secret GitHub API token to use for making API requests.
|
||||
default: ${{ github.token }}
|
||||
required: true
|
||||
outputs:
|
||||
last_status:
|
||||
description: "Conclusion of last workflow run on current branch"
|
||||
value: ${{ steps.last_status.outputs.last_status }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Get workflow id
|
||||
shell: bash
|
||||
run: |
|
||||
WORKFLOW_ID=$(curl --header 'authorization: Bearer ${{ inputs.github_token }}' \
|
||||
--header 'content-type: application/json' \
|
||||
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .workflow_id)
|
||||
echo "WORKFLOW_ID=$WORKFLOW_ID" >> $GITHUB_ENV
|
||||
echo "Workflow id: ${WORKFLOW_ID}"
|
||||
- name: Get previous build status
|
||||
shell: bash
|
||||
id: last_status
|
||||
run: |
|
||||
last_status=$(curl --silent --header 'authorization: Bearer ${{ inputs.github_token }}' \
|
||||
--header 'content-type: application/json' \
|
||||
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ env.GITHUB_HEAD_REF }}" \
|
||||
| jq -r .workflow_runs[0].conclusion)
|
||||
echo "Status of the previous build: $last_status"
|
||||
echo "::set-output name=last_status::${last_status}"
|
||||
31
.github/workflows/sims-045.yml
vendored
31
.github/workflows/sims-045.yml
vendored
@ -104,11 +104,38 @@ jobs:
|
||||
run: |
|
||||
make test-sim-multi-seed-short
|
||||
|
||||
sims-fail:
|
||||
sims-notify-success:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
if: ${{ failure() }}
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ success() }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get previous workflow status
|
||||
uses: ./.github/actions/last-workflow-status
|
||||
id: last_status
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify Slack on success
|
||||
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: cosmos-sdk-sims
|
||||
SLACK_USERNAME: Sim Tests release/0.45.x
|
||||
SLACK_ICON_EMOJI: ":white_check_mark:"
|
||||
SLACK_COLOR: good
|
||||
SLACK_MESSAGE: 0.45.x Sims are passing
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
sims-notify-failure:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ failure() }}
|
||||
steps:
|
||||
- name: Notify Slack on failure
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
|
||||
31
.github/workflows/sims-046.yml
vendored
31
.github/workflows/sims-046.yml
vendored
@ -104,11 +104,38 @@ jobs:
|
||||
run: |
|
||||
make test-sim-multi-seed-short
|
||||
|
||||
sims-fail:
|
||||
sims-notify-success:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
if: ${{ failure() }}
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ success() }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get previous workflow status
|
||||
uses: ./.github/actions/last-workflow-status
|
||||
id: last_status
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify Slack on success
|
||||
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: cosmos-sdk-sims
|
||||
SLACK_USERNAME: Sim Tests release/0.46.x
|
||||
SLACK_ICON_EMOJI: ":white_check_mark:"
|
||||
SLACK_COLOR: good
|
||||
SLACK_MESSAGE: 0.46.x Sims are passing
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
sims-notify-failure:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ failure() }}
|
||||
steps:
|
||||
- name: Notify Slack on failure
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
|
||||
48
.github/workflows/sims.yml
vendored
48
.github/workflows/sims.yml
vendored
@ -102,11 +102,38 @@ jobs:
|
||||
run: |
|
||||
make test-sim-multi-seed-short
|
||||
|
||||
sims-fail:
|
||||
sims-notify-success:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
if: ${{ failure() }}
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ success() }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get previous workflow status
|
||||
uses: ./.github/actions/last-workflow-status
|
||||
id: last_status
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify Slack on success
|
||||
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: cosmos-sdk-sims
|
||||
SLACK_USERNAME: Sim Tests
|
||||
SLACK_ICON_EMOJI: ":white_check_mark:"
|
||||
SLACK_COLOR: good
|
||||
SLACK_MESSAGE: Sims are passing
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
sims-notify-failure:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ failure() }}
|
||||
steps:
|
||||
- name: Notify Slack on failure
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
@ -118,20 +145,3 @@ jobs:
|
||||
SLACK_COLOR: danger
|
||||
SLACK_MESSAGE: Sims are failing
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
sims-success:
|
||||
needs:
|
||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||
if: ${{ success() }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Notify Slack on failure
|
||||
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: cosmos-sdk-sims
|
||||
SLACK_USERNAME: Sim Tests
|
||||
SLACK_ICON_EMOJI: ":white_check_mark:"
|
||||
SLACK_COLOR: good
|
||||
SLACK_MESSAGE: Sims are passing
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user