Skip to content

Commit

Permalink
fix: github discussions to slack
Browse files Browse the repository at this point in the history
  • Loading branch information
Viraj-10 committed Aug 29, 2024
1 parent 5329ea6 commit 25c2f6f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/discussion-to-slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Discussion to Slack Notification

on:
discussion:
types: [created]

jobs:
notify-slack:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get discussion details
id: discussion-details
run: |
echo "title=${{ github.event.discussion.title }}" >> $GITHUB_OUTPUT
echo "body=${{ github.event.discussion.body }}" >> $GITHUB_OUTPUT
echo "url=${{ github.event.discussion.html_url }}" >> $GITHUB_OUTPUT
echo "author=${{ github.event.discussion.user.login }}" >> $GITHUB_OUTPUT
echo "category=${{ github.event.discussion.category.name }}" >> $GITHUB_OUTPUT
- name: Post to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ISSUES_ID }}
slack-message: |
:speech_balloon: New Discussion Created :speech_balloon:
*Title:* ${{ steps.discussion-details.outputs.title }}
*Author:* ${{ steps.discussion-details.outputs.author }}
*Category:* ${{ steps.discussion-details.outputs.category }}
*Link:* ${{ steps.discussion-details.outputs.url }}
*Discussion Body:*
```
${{ steps.discussion-details.outputs.body }}
```
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit 25c2f6f

Please sign in to comment.