Skip to content

[Feature]: Add PR Search Bar & Label Filter in SubmitPR Page #56

[Feature]: Add PR Search Bar & Label Filter in SubmitPR Page

[Feature]: Add PR Search Bar & Label Filter in SubmitPR Page #56

Workflow file for this run

name: Notify Discord
on:
issues:
types: [opened, closed]
pull_request:
types: [opened, closed]
watch:
fork:
repository_dispatch:
push:
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Discord Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
EVENT_NAME="${{ github.event_name }}"
ACTION="${{ github.event.action }}"
REPO="${{ github.repository }}"
ACTOR="${{ github.actor }}"
MESSAGE=""
if [[ "$EVENT_NAME" == "issues" ]]; then
ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_NUMBER="${{ github.event.issue.number }}"
ISSUE_URL="https://github.com/$REPO/issues/$ISSUE_NUMBER"
if [[ "$ACTION" == "opened" ]]; then
MESSAGE="πŸ“ New Issue Created: **[$ISSUE_TITLE]($ISSUE_URL)** by **$ACTOR**"
elif [[ "$ACTION" == "closed" ]]; then
MESSAGE="βœ… Issue Closed: **[$ISSUE_TITLE]($ISSUE_URL)** by **$ACTOR**"
fi
elif [[ "$EVENT_NAME" == "pull_request" ]]; then
PR_TITLE="${{ github.event.pull_request.title }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_URL="https://github.com/$REPO/pull/$PR_NUMBER"
if [[ "$ACTION" == "opened" ]]; then
MESSAGE="πŸš€ New Pull Request: **[$PR_TITLE]($PR_URL)** by **$ACTOR**"
elif [[ "$ACTION" == "closed" ]]; then
MESSAGE="πŸ”’ Pull Request Closed: **[$PR_TITLE]($PR_URL)** by **$ACTOR**"
fi
elif [[ "$EVENT_NAME" == "watch" ]]; then
MESSAGE="⭐ Repository starred by **$ACTOR**"
elif [[ "$EVENT_NAME" == "fork" ]]; then
MESSAGE="🍴 Repository forked by **$ACTOR**"
elif [[ "$EVENT_NAME" == "push" ]]; then
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
COMMIT_SHA="${{ github.sha }}"
COMMIT_URL="https://github.com/$REPO/commit/$COMMIT_SHA"
if [[ -n "$COMMIT_MESSAGE" ]]; then
MESSAGE="πŸ“¦ New Push to **$REPO** by **$ACTOR**\n**Commit:** [$COMMIT_MESSAGE]($COMMIT_URL)"
else
MESSAGE="πŸ“¦ New Push to **$REPO** by **$ACTOR**"
fi
fi
if [[ -n "$MESSAGE" ]]; then
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"$MESSAGE\"}" \
"$DISCORD_WEBHOOK"
else
echo "No valid event or message to send."
fi