Skip to content

Commit fe64f38

Browse files
fix: make python canary cron report failures correctly (#2930)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 437b4e4 commit fe64f38

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/python-cron.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
needs: find-tox-testenv
3434
if: ${{ needs.find-tox-testenv.outputs.list != '[]' }}
3535
runs-on: ubuntu-latest
36-
continue-on-error: true
3736
strategy:
3837
fail-fast: false
3938
matrix:
@@ -61,29 +60,41 @@ jobs:
6160
slack:
6261
name: Slack notification
6362
needs: canary
63+
if: ${{ always() }}
6464
runs-on: ubuntu-latest
65+
env:
66+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
6567
steps:
6668
- uses: actions/download-artifact@v4
67-
- name: List failures as markdown
69+
if: ${{ needs.canary.result == 'failure' }}
70+
- name: List failures
71+
if: ${{ needs.canary.result == 'failure' }}
6872
run: |
6973
{
7074
echo "list<<EOF"
71-
find . -maxdepth 1 -type d ! -name '.' | sed 's|^\./||' | rev | sort -u | rev | nl -w2 -s'. '
75+
find . -maxdepth 1 -type d ! -name '.' | sed 's|^\./||' | sort | nl -w2 -s'. '
7276
echo "EOF"
7377
} >> "$GITHUB_OUTPUT"
7478
id: failures
75-
- name: Create message text
76-
if: ${{ steps.failures.outputs.list != '' }}
79+
- name: Build message
80+
env:
81+
CANARY_RESULT: ${{ needs.canary.result }}
82+
FAILURE_LIST: ${{ steps.failures.outputs.list }}
7783
run: |
84+
if [ "$CANARY_RESULT" = "failure" ]; then
85+
MSG="Python canary cron failed:
86+
$FAILURE_LIST
87+
$RUN_URL"
88+
else
89+
MSG="Python canary cron passed: $RUN_URL"
90+
fi
7891
{
7992
echo "text<<EOF"
80-
echo "CI Failures for Python Packages:"
81-
echo "${{ steps.failures.outputs.list }}"
93+
echo "$MSG"
8294
echo "EOF"
8395
} >> "$GITHUB_OUTPUT"
8496
id: message
8597
- name: Send message to Slack
86-
if: ${{ steps.failures.outputs.list != '' }}
8798
uses: slackapi/slack-github-action@v1
8899
with:
89100
payload: |

0 commit comments

Comments
 (0)