From b93c931f5e43999130057089ece5741a88a6c036 Mon Sep 17 00:00:00 2001 From: Ashley Weaver <134093673+ashley-weaver@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:57:15 -0400 Subject: [PATCH] [DPC-3596] Fix workflow logic (#121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎫 Ticket https://jira.cms.gov/browse/3596 ## 🛠 Changes Previous workflow sent a Slack message regardless of whether the test succeeded or not. Now it only sends on failures. ## ℹ️ Context ## 🧪 Validation --- .github/workflows/broken-link-check.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/broken-link-check.yml b/.github/workflows/broken-link-check.yml index 1a15d7bd..80a45664 100644 --- a/.github/workflows/broken-link-check.yml +++ b/.github/workflows/broken-link-check.yml @@ -15,11 +15,10 @@ jobs: uses: lycheeverse/lychee-action@v1 id: lychee with: - fail: true jobSummary: true args: --no-progress --accept '200..=299, 401, 405' . - - name: "Send Slack alert if failing" - if: always() && env.lychee_exit_code != 0 + - name: "Send Slack alert" + if: env.lychee_exit_code != 0 uses: slackapi/slack-github-action@v1.26.0 env: SLACK_WEBHOOK_URL: "https://hooks.slack.com/triggers/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" # TODO: set as env var? @@ -28,3 +27,6 @@ jobs: { "Details": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" } + - name: "Fail workflow" + if: env.lychee_exit_code != 0 + run: exit ${{ env.lychee_exit_code }}