Skip to content

Commit

Permalink
actions: conditional slack message
Browse files Browse the repository at this point in the history
Sigh, to avoid errors if the token is not present, as in forked repos.
See slackapi/slack-github-action#124.
  • Loading branch information
mtzguido committed Jun 13, 2023
1 parent f0ca483 commit 2007857
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/linux-x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ jobs:
;;
esac
echo "CI_COMMIT=$(echo ${{ github.event.head_commit.id || github.event.pull_request.head.sha }} | grep -o '^........')" >> $GITHUB_ENV
- name: Post to the Slack channel
- name: Check if we should post to Slack
if: ${{ always() }}
run:
echo "SLACK_SHOULD_POST=$SLACK_SHOULD_POST" >> $GITHUB_ENV
env:
SLACK_SHOULD_POST: ${{ secrets.SLACK_WEBHOOK_URL != '' ? 'yes' : 'no' }}

- name: Post to the Slack channel
if: ${{ always () && env.SLACK_SHOULD_POST == 'yes' }}
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
Expand Down

0 comments on commit 2007857

Please sign in to comment.