Case-Study1 / .github /workflows /notification.yml
vinayakrevankar's picture
updated notification.yml and added gitignore and setup.sh
5abb6bc
name: Discord and Teams Notification
on:
push:
branches: [main]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: SendDiscordNotification
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
COMMIT_URL="${{ github.event.head_commit.url }}"
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\": \"@everyone πŸ”₯ **A new commit was pushed to the main branch by $GITHUB_ACTOR** πŸ”₯\\n**Commit Message:** ${COMMIT_MESSAGE} \\n**Commit URL:** ${COMMIT_URL}\"}" \
$DISCORD_WEBHOOK_URL
- name: SendTeamsNotification
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK }}
run: |
COMMIT_URL="${{ github.event.head_commit.url }}"
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
curl -H 'Content-Type: application/json' \
-d "{\"@type\": \"MessageCard\", \"@context\": \"http://schema.org/extensions\", \"summary\": \"New commit in GitHub\", \"sections\": [{\"activityTitle\": \"πŸ”₯ **A new commit was pushed to the main branch by $GITHUB_ACTOR** πŸ”₯\", \"text\": \"**Commit Message:** ${COMMIT_MESSAGE}\\n**Commit URL:** [Click Here](${COMMIT_URL})\"}]}" \
$TEAMS_WEBHOOK_URL