Skip to content

Commit

Permalink
Create Dicord notification.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Salman-18 authored Dec 25, 2023
1 parent cbc0832 commit 5da015d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/Dicord notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Push and Pull Request Notification

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
notify_on_activity:
runs-on: ubuntu-latest

steps:
- name: Notify on Discord
run: |
if [ "${{ github.event_name }}" = "push" ]; then
MESSAGE="New push to main branch by ${GITHUB_ACTOR}"
elif [ "${{ github.event_name }}" = "pull_request" ]; then
MESSAGE="New pull request ${{ github.event.number }} by ${GITHUB_ACTOR}: ${GITHUB_SERVER_URL}/${{ github.repository }}/pull/${{ github.event.number }}"
fi
curl -X POST -H "Content-Type: application/json" -d "{\"content\":\"$MESSAGE\"}" "${{ secrets.DISCORD_WEBHOOK_URL }}"
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

0 comments on commit 5da015d

Please sign in to comment.