-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
0d6c6a1
commit 030ee99
Showing
1 changed file
with
0 additions
and
97 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +0,0 @@ | ||
name: Send Notifications to Discord | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
issues: | ||
types: [opened] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
notify-discord: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Notify Discord for Push | ||
if: github.event_name == 'push' | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
run: | | ||
LAST_COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s') | ||
LAST_COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an') | ||
REPO_NAME=${{ github.repository }} | ||
BRANCH_NAME=${{ github.ref_name }} | ||
COMMIT_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{ | ||
\"embeds\": [ | ||
{ | ||
\"title\": \"${LAST_COMMIT_AUTHOR} pushed to ${REPO_NAME}\", | ||
\"url\": \"${COMMIT_URL}\", | ||
\"description\": \"**Branch**: ${BRANCH_NAME}\n**Message**: ${LAST_COMMIT_MESSAGE}\", | ||
\"color\": 3447003 | ||
} | ||
] | ||
}" \ | ||
$DISCORD_WEBHOOK | ||
- name: Notify Discord for Issues | ||
if: github.event_name == 'issues' | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
run: | | ||
ISSUE_TITLE=${{ github.event.issue.title }} | ||
ISSUE_NUMBER=${{ github.event.issue.number }} | ||
ISSUE_BODY=${{ github.event.issue.body }} | ||
ISSUE_URL=${{ github.event.issue.html_url }} | ||
REPO_NAME=${{ github.repository }} | ||
ACTOR=${{ github.actor }} | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{ | ||
\"embeds\": [ | ||
{ | ||
\"title\": \"New Issue: #${ISSUE_NUMBER} - ${ISSUE_TITLE}\", | ||
\"url\": \"${ISSUE_URL}\", | ||
\"description\": \"${ISSUE_BODY}\", | ||
\"color\": 16711680, | ||
\"footer\": { | ||
\"text\": \"Opened by ${ACTOR}\" | ||
} | ||
} | ||
] | ||
}" \ | ||
$DISCORD_WEBHOOK | ||
- name: Notify Discord for Release | ||
if: github.event_name == 'release' | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
run: | | ||
RELEASE_NAME=${{ github.event.release.name }} | ||
RELEASE_TAG=${{ github.event.release.tag_name }} | ||
RELEASE_BODY=${{ github.event.release.body }} | ||
RELEASE_URL=${{ github.event.release.html_url }} | ||
REPO_NAME=${{ github.repository }} | ||
ACTOR=${{ github.actor }} | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{ | ||
\"embeds\": [ | ||
{ | ||
\"title\": \"New Release: ${RELEASE_NAME} (${RELEASE_TAG})\", | ||
\"url\": \"${RELEASE_URL}\", | ||
\"description\": \"${RELEASE_BODY}\", | ||
\"color\": 65280, | ||
\"footer\": { | ||
\"text\": \"Released by ${ACTOR}\" | ||
} | ||
} | ||
] | ||
}" \ | ||
$DISCORD_WEBHOOK | ||