Skip to content

Commit 4d75e05

Browse files
committed
ci: add per-sample slack notifications and log uploads on failure
1 parent 32c9bea commit 4d75e05

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,33 @@ jobs:
5959
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
6060
DEBUG: 1
6161
DNS_ADDRESS: 127.0.0.1
62+
63+
- name: Compute sample name
64+
if: always()
65+
id: sample-name
66+
run: |
67+
name="${{ matrix.directory }}"
68+
name="${name#./}"
69+
name="${name//\//-}"
70+
echo "name=$name" >> "$GITHUB_OUTPUT"
71+
72+
- name: Send a Slack notification
73+
if: failure() || github.event_name != 'pull_request'
74+
uses: ravsamhq/notify-slack-action@v2
75+
with:
76+
status: ${{ job.status }}
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
notification_title: "Sample `${{ steps.sample-name.outputs.name }}` ({workflow}) has {status_message}"
79+
message_format: "{emoji} *${{ steps.sample-name.outputs.name }}* {status_message} in <{repo_url}|{repo}>"
80+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
81+
notify_when: "failure"
82+
env:
83+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
84+
85+
- name: Upload LocalStack logs
86+
if: failure()
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: logs-${{ steps.sample-name.outputs.name }}
90+
path: ${{ matrix.directory }}/logs.txt
91+
if-no-files-found: ignore

0 commit comments

Comments
 (0)