File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,18 +11,19 @@ jobs:
1111 - name : Send all commits to Discord
1212 run : |
1313 REPO="${{ github.repository }}"
14+ BRANCH="${GITHUB_REF##*/}" # dynamically get branch name
1415 ACTOR="${{ github.actor }}"
1516 COMMIT_TEXT=""
1617
17- # Loop through all commits in the push
18- for commit in $( jq -c '.commits[]' < "${GITHUB_EVENT_PATH}") ; do
18+ # Loop through all commits safely
19+ jq -c '.commits[]' < "${GITHUB_EVENT_PATH}" | while read commit ; do
1920 COMMIT_MSG=$(echo "$commit" | jq -r '.message')
2021 COMMIT_URL=$(echo "$commit" | jq -r '.url')
21- COMMIT_TEXT="$COMMIT_TEXT- [$COMMIT_MSG]($COMMIT_URL)\n "
22+ COMMIT_TEXT="${ COMMIT_TEXT} - [$COMMIT_MSG]($COMMIT_URL)"
2223 done
2324
2425 # Prepare payload with proper newlines
25- PAYLOAD=$(jq -n --arg content "$ACTOR pushed to **main ** in [$REPO](https://github.com/$REPO):
26+ PAYLOAD=$(jq -n --arg content "🚀 $ACTOR pushed to **$BRANCH ** in [$REPO](https://github.com/$REPO):
2627 $COMMIT_TEXT" '{content: $content}')
2728
2829 # Send to Discord
You can’t perform that action at this time.
0 commit comments