Skip to content

Commit

Permalink
discord update test
Browse files Browse the repository at this point in the history
  • Loading branch information
soulsyrup committed Nov 17, 2023
1 parent c31703f commit 3cd25d9
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/discord_notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,37 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2


- name: Prepare commit information
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an (%ae)")
echo "Commit Message: $COMMIT_MESSAGE"
echo "Commit Author: $COMMIT_AUTHOR"
- 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 <%ae>")
COMMIT_URL="https://github.com/Unlimited-Research-Cooperative/Human-Brain-Rat/commits/${{ github.sha }}"
curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"New commit by $COMMIT_AUTHOR! Check out the latest changes: $COMMIT_URL\", \"embeds\": [{ \"title\": \"$COMMIT_MESSAGE\" }]}" https://discord.com/api/webhooks/$DISCORD_WEBHOOK_ID/$DISCORD_WEBHOOK_TOKEN
JSON_PAYLOAD=$(jq -n \
--arg content "New commit by $COMMIT_AUTHOR! Check out the latest changes: $COMMIT_URL" \
--arg title "$COMMIT_MESSAGE" \
'{content: $content, embeds: [{title: $title}]}')
echo "Payload: $JSON_PAYLOAD"
curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" 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 <%ae>")
COMMIT_URL="https://github.com/Unlimited-Research-Cooperative/Human-Brain-Rat/commits/${{ github.sha }}"
curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"New commit by $COMMIT_AUTHOR! Check out the latest changes: $COMMIT_URL\", \"embeds\": [{ \"title\": \"$COMMIT_MESSAGE\" }]}" https://discord.com/api/webhooks/$URC_WEBHOOK_ID/$URC_WEBHOOK_TOKEN
JSON_PAYLOAD=$(jq -n \
--arg content "New commit by $COMMIT_AUTHOR! Check out the latest changes: $COMMIT_URL" \
--arg title "$COMMIT_MESSAGE" \
'{content: $content, embeds: [{title: $title}]}')
echo "Payload: $JSON_PAYLOAD"
curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" https://discord.com/api/webhooks/$URC_WEBHOOK_ID/$URC_WEBHOOK_TOKEN

0 comments on commit 3cd25d9

Please sign in to comment.