Skip to content

Commit ab89ac6

Browse files
committed
ci: handle job cancellations properly
Use always() correctly. Don't run notify_slack if job has been cancelled.
1 parent 4e9dfb9 commit ab89ac6

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/.notify.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ on:
1515

1616
jobs:
1717
notify_slack:
18+
if: ${{ inputs.job_result == 'failure' && github.repository == 'OpenSIPS/opensips' }}
1819
runs-on: ubuntu-latest
1920
env:
2021
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
2122
steps:
2223
- name: Notify slack fail
23-
if: ${{ inputs.job_result == 'failure' && github.repository == 'OpenSIPS/opensips' && env.SLACK_BOT_TOKEN != '' }}
24+
if: ${{ env.SLACK_BOT_TOKEN != '' }}
2425
uses: slackapi/slack-github-action@v3.0.3
2526
with:
2627
method: chat.postMessage
@@ -39,7 +40,6 @@ jobs:
3940
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Open this run in GitHub Actions>"
4041
4142
- name: Post Fail
42-
if: ${{ inputs.job_result == 'failure' }}
4343
run: |
4444
echo "💥 \"${{ inputs.job_name }}\" failed – marking workflow 💩" >&2
4545
exit 1

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
job_result: ${{ needs.Fuzzing.result }}
3333
secrets:
3434
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
35-
if: ${{ always() }}
35+
if: ${{ always() && !cancelled() }}

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ jobs:
8686
job_result: ${{ needs.build.result }}
8787
secrets:
8888
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
89-
if: ${{ always() }}
89+
if: ${{ always() && !cancelled() }}

.github/workflows/multiarch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ jobs:
7878
job_result: ${{ needs.build_multiarch.result }}
7979
secrets:
8080
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
81-
if: ${{ always() }}
81+
if: ${{ always() && !cancelled() }}

.github/workflows/rtp.io.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ jobs:
139139
job_result: ${{ needs.build_test_rtp_io_dock.result }}
140140
secrets:
141141
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
142-
if: ${{ always() }}
142+
if: ${{ always() && !cancelled() }}

.github/workflows/unittests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ jobs:
127127
job_result: ${{ needs.build_and_test.result }}
128128
secrets:
129129
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
130-
if: ${{ always() }}
130+
if: ${{ always() && !cancelled() }}

0 commit comments

Comments
 (0)