[Feature]: Add PR Search Bar & Label Filter in SubmitPR Page #56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |