Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
Shell
1234567891011121314151617181920212223242526#!/bin/bash
WEBHOOK_URL=$DISCORD_WEBHOOK_URL # Define the Discord webhook URLCOMMIT_URL="$REPOSITORY_URL/commit/$COMMIT_REF"
# Get the last commit message and escape backticksCOMMIT_MESSAGE=$(git log -1 --pretty=%B | sed 's/`/\\`/g')
# Get the short hashSHORT_HASH="${COMMIT_REF:0:7}"
# Create the Discord messageDISCORD_MESSAGE="$COMMIT_MESSAGE ([$SHORT_HASH](<$COMMIT_URL>))"FLAGS="2" # Define the message flags (SUPPRESS_EMBEDS)
# Use Python to generate a properly escaped JSON payloadJSON_PAYLOAD=$(python -c "import jsonimport sysmessage = sys.argv[1]print(json.dumps({'content': message, 'flags': $FLAGS}))" "$DISCORD_MESSAGE")
# Send the POST request to the Discord webhook URLcurl -H "Content-Type: application/json" -X POST -d "$JSON_PAYLOAD" $WEBHOOK_URL