-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding workflow to send messages to tq42-crypto-support channel in Slack when Issues or Comments on existing Issues are submitted
- Loading branch information
1 parent
c0ffee8
commit 8b709ff
Showing
1 changed file
with
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: GitHub Issue Notification to Slack | ||
|
||
on: | ||
issues: | ||
types: [opened, edited] | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
notifySlack: | ||
runs-on: ubuntu-latest | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
SLACK_CHANNEL: 'C071XET3G4S' | ||
steps: | ||
- name: Notify Slack on Issue or Comment | ||
run: | | ||
if [ "${{ github.event_name }}" == "issues" ]; then | ||
PAYLOAD='{"channel":"'"$SLACK_CHANNEL"'","text":"New or edited issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"}' | ||
elif [ "${{ github.event_name }}" == "issue_comment" ]; then | ||
PAYLOAD='{"channel":"'"$SLACK_CHANNEL"'","text":"New comment on issue <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}> by @${{ github.event.comment.user.login }}:\n<${{ github.event.comment.html_url }}|View Comment>"}' | ||
fi | ||
curl -X POST -H 'Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}' -H 'Content-type: application/json; charset=utf-8' --data "$PAYLOAD" https://slack.com/api/chat.postMessage |