Skip to content

Commit

Permalink
Create notify-slack-on-issue.yml
Browse files Browse the repository at this point in the history
adding workflow to send messages to tq42-crypto-support channel in Slack when Issues or Comments on existing Issues are submitted
  • Loading branch information
jeffreytitus authored May 8, 2024
1 parent c0ffee8 commit 8b709ff
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/notify-slack-on-issue.yml
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

0 comments on commit 8b709ff

Please sign in to comment.