Skip to content

Commit cb444c4

Browse files
authored
Update gradle.yml
1 parent b3d0221 commit cb444c4

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/gradle.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,27 @@ jobs:
4040
with:
4141
name: IamMusicPlayerRenewedFabric
4242
path: fabric/build/libs
43-
compression-level: 9
43+
compression-level: 9
44+
45+
- name: Install GitHub CLI
46+
if: failure()
47+
run: sudo apt update && sudo apt install -y gh
48+
49+
- name: Dump logs and notify Discord
50+
if: failure()
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
DISCORD_WEBHOOK_URL: ${{ secrets.IAMLOGGER }}
54+
run: |
55+
mkdir logs
56+
gh run download $GITHUB_RUN_ID -D logs
57+
58+
# Extract the last 100 lines from all logs (or change as needed)
59+
output=$(find logs -type f -name '*.txt' -exec tail -n 100 {} \; | sed 's/"/\\"/g' | head -c 1800)
60+
61+
payload="{\"content\": \"❌ **Build failed!**\n\`\`\`\n$output\n\`\`\`\"}"
62+
63+
curl -H "Content-Type: application/json" \
64+
-X POST \
65+
-d "$payload" \
66+
"$DISCORD_WEBHOOK_URL"

0 commit comments

Comments
 (0)