Create discord_notification.yml #1
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
name: Send discord notification | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Send Discord notification to Server 1 | |
env: | |
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }} | |
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s") | |
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an") | |
COMMIT_DESCRIPTION=$(git log -1 --pretty=format:"%b") | |
curl -X POST -H "Content-Type: application/json" -d "{ \"content\": \"New commit by $COMMIT_AUTHOR! Check out the latest changes: https://github.com/Unlimited-Research-Cooperative/Bacteria-Neural-Network/commits/${{ github.sha }}\", \"embeds\": [ { \"title\": \"$COMMIT_MESSAGE\", \"description\": \"$COMMIT_DESCRIPTION\" } ] }" https://discord.com/api/webhooks/$DISCORD_WEBHOOK_ID/$DISCORD_WEBHOOK_TOKEN | |
- name: Send Discord notification to Server 2 | |
env: | |
URC_WEBHOOK_ID: ${{ secrets.URC_WEBHOOK_ID }} | |
URC_WEBHOOK_TOKEN: ${{ secrets.URC_WEBHOOK_TOKEN }} | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s") | |
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an") | |
COMMIT_DESCRIPTION=$(git log -1 --pretty=format:"%b") | |
curl -X POST -H "Content-Type: application/json" -d "{ \"content\": \"New commit by $COMMIT_AUTHOR! Check out the latest changes: https://github.com/Unlimited-Research-Cooperative/Bacteria-Neural-Network/commits/${{ github.sha }}\", \"embeds\": [ { \"title\": \"$COMMIT_MESSAGE\", \"description\": \"$COMMIT_DESCRIPTION\" } ] }" https://discord.com/api/webhooks/$URC_WEBHOOK_ID/$URC_WEBHOOK_TOKEN |