From 428fb78daa35bcbf41da7ab83eff64a0b682b742 Mon Sep 17 00:00:00 2001 From: Jover Date: Wed, 2 Aug 2023 17:26:23 -0700 Subject: [PATCH] pathogen-repo-build: Add failure notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When GitHub Actions fail, they automatically send a notification to the GitHub user who triggered the action or last edited the workflow cron schedule¹. This additional Slack notification ensures that the whole team is notified of failures. This has been our stopgap for monitoring automated pathogen workflows since we have not set up more robust monitoring dashboards. I expect this step to be removed once we migrate to a different monitoring system outside of Slack. ¹ https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs --- .github/workflows/pathogen-repo-build.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/pathogen-repo-build.yaml b/.github/workflows/pathogen-repo-build.yaml index 729a925..440beda 100644 --- a/.github/workflows/pathogen-repo-build.yaml +++ b/.github/workflows/pathogen-repo-build.yaml @@ -233,3 +233,13 @@ jobs: logs/ .snakemake/log/ ${{ inputs.artifact-paths }} + + # Send Slack notification about failure if the workflow has access to Slack variables + - if: ${{ failure() && env.slack-available == 'true' }} + # The secrets context is not allowed in "if:" conditions, so we must + # launder it thru env. Note that we not depending on the SLACK_* env vars + # because we don't want to depend on the "Set environment variables" step. + env: + slack-available: ${{ secrets.SLACK_TOKEN != '' && vars.SLACK_CHANNELS != '' }} + name: Notify pipeline failed + uses: ./.git/nextstrain/.github/actions/notify-on-failure