Skip to content

test 2

test 2 #4

Workflow file for this run

name: Discord Push Notifications
on:
push:
branches: [ main ]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send all commits to Discord
run: |
REPO="${{ github.repository }}"
ACTOR="${{ github.actor }}"
COMMIT_TEXT=""
# Loop through all commits in the push
for commit in $(jq -c '.commits[]' < "${GITHUB_EVENT_PATH}"); do
COMMIT_MSG=$(echo "$commit" | jq -r '.message')
COMMIT_URL=$(echo "$commit" | jq -r '.url')
COMMIT_TEXT="$COMMIT_TEXT- [$COMMIT_MSG]($COMMIT_URL)\n"
done
# Prepare payload with proper newlines
PAYLOAD=$(jq -n --arg content "$ACTOR pushed to **main** in [$REPO](https://github.com/$REPO):
$COMMIT_TEXT" '{content: $content}')
# Send to Discord
curl -H "Content-Type: application/json" -d "$PAYLOAD" ${{ secrets.DISCORD_WEBHOOK }}