Skip to content

Commit

Permalink
Fix #2 for notify workflow when SLACK_HOOK is not set
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed Jun 30, 2021
1 parent 09f84d3 commit a450f66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/notify.yml
Expand Up @@ -20,7 +20,7 @@ jobs:

notify:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'schedule' && secrets.SLACK_HOOK }}
if: ${{ github.event.workflow_run.event == 'schedule' }}
steps:

- name: Post status to Slack
Expand All @@ -32,4 +32,4 @@ jobs:
repo_url="https://github.com/${{ github.repository }}/actions/workflows/test.yml"
emoji=$(if [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then echo ":white_check_mark:"; else echo ":x:"; fi)
json="{ \"text\": \"$emoji <$repo_url|${{ github.repository }}>: Scheduled run <$run_url|$run_id> on branch <$branch_url|$branch>: ${{ github.event.workflow_run.conclusion }}\" }"
curl -s -d "payload=$json" ${{ secrets.SLACK_HOOK }}
if [[ -n ${{ secrets.SLACK_HOOK }} ]]; then curl -s -d "payload=$json" ${{ secrets.SLACK_HOOK }}; else echo "Skipping notification because SLACK_HOOK secret is not set"; fi

0 comments on commit a450f66

Please sign in to comment.