Skip to content

Commit

Permalink
Add support for discussion notifier [skip ci] (#9499)
Browse files Browse the repository at this point in the history
Change-Id: I0b866a0b231b6ec2e98265da2a688513f77abbb0
Signed-off-by: PrajjuS <[email protected]>
  • Loading branch information
PrajjuS authored May 11, 2022
1 parent 6d85648 commit 6056b73
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/discussion-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Discussion Notifier

on:
discussion:
types: [created]

jobs:
discussion:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main

- name: Get Info
run: |
sudo apt-get install jq -y &> /dev/null
echo "DIS_TITLE=$(jq --raw-output .discussion.title ${GITHUB_EVENT_PATH})" >> ${GITHUB_ENV}
echo "DIS_URL=$(jq --raw-output .discussion.html_url ${GITHUB_EVENT_PATH})" >> ${GITHUB_ENV}
- name: Notify in Telegram
run: |
TgNotify() {
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TG_BOT_TOKEN }}/sendMessage" -d chat_id="${{ secrets.TG_CHAT_ID }}" \
-d parse_mode=Markdown \
-d text="${1}" \
-d disable_web_page_preview=true
}
TgNotify "
#DISCUSSION
*New Discussion Started at* [${{ github.repository }}](https://github.com/${{ github.repository }})
*Title:* \`${DIS_TITLE}\`
*User:* [${{ github.actor }}](https://github.com/${{ github.actor }})
*Discussion URL:* [Here](${DIS_URL})" &> /dev/null

0 comments on commit 6056b73

Please sign in to comment.