-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a composite action that can be used to send Slack notifications for failed GitHub Action workflows. Intended to be used with the pathogen-repo-build workflow, but I've made it a separate composite action because it may be useful for monitoring GitHub Actions that are not running Nextstrain builds.
- Loading branch information
1 parent
261c64f
commit 45592e8
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Notify Slack on failure | ||
description: >- | ||
Sends Slack notification with link to a GitHub Action workflow run that failed. | ||
Intended to be used for automated pathogen build workflows to ensure that the | ||
entire team is notified of a GitHub Action failure and not just the GitHub | ||
user who originally launched and/or scheduled the workflow. | ||
Requires two environment variables to be set in the workflow: | ||
- SLACK_TOKEN | ||
- SLACK_CHANNELS | ||
SLACK_TOKEN is the OAuth token for the Slack app that has permissions to send messages. | ||
SLACK_CHANNELS is the name or channel id for the intended Slack channel. | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: nextstrain/ingest | ||
path: nextstrain-ingest | ||
sparse-checkout: | | ||
notify-on-job-fail | ||
- name: Notify job failure | ||
shell: bash | ||
run: ./nextstrain-ingest/notify-on-job-fail "$WORKFLOW_NAME" "$JOB_REPO" | ||
env: | ||
WORKFLOW_NAME: ${{ github.workflow }} | ||
JOB_REPO: ${{ github.repository }} |