Skip to content

Commit

Permalink
Update 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 5eacd32 commit 4e0131c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/Dicord notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ jobs:
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 }} and it assign to ${{ github.event.issue.assignee.login }}"
MESSAGE="New pull request #${{ github.event.number }} by ${GITHUB_ACTOR}: ${{ github.event.pull_request.html_url }}"
# Fetch assignees using GitHub REST API
ASSIGNEE_LIST=$(curl -sH "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.pull_request.url }}/assignees" | jq -r '.[].login')
if [ -n "$ASSIGNEE_LIST" ]; then
MESSAGE="$MESSAGE\nAssignees: $ASSIGNEE_LIST"
else
MESSAGE="$MESSAGE\nNo assignees."
fi
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 4e0131c

Please sign in to comment.