Skip to content

Commit 4d3ed66

Browse files
ci: discord using curl
1 parent 004550a commit 4d3ed66

File tree

2 files changed

+34
-16
lines changed

2 files changed

+34
-16
lines changed

.github/workflows/release-announcement.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,42 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414

15-
- name: Set Release Context
15+
- name: GitHub Releases to Discord
16+
shell: bash
1617
run: |
1718
RELEASE_JSON=$(gh release view --json body,tagName,url,name)
1819
19-
jq --argjson rel "$RELEASE_JSON" '. + {release: $rel}' "$GITHUB_EVENT_PATH" > "$GITHUB_EVENT_PATH.tmp" && mv "$GITHUB_EVENT_PATH.tmp" "$GITHUB_EVENT_PATH"
20+
RAW_NAME=$(echo "$RELEASE_JSON" | jq -r '.name // .tagName // ""')
21+
RAW_BODY=$(echo "$RELEASE_JSON" | jq -r '.body // ""')
22+
HTML_URL=$(echo "$RELEASE_JSON" | jq -r '.url // ""')
23+
RAW_AVATAR_URL="https://github.com/webpack/media/blob/90b54d02fa1cfc8aa864a8322202f74ac000f5d2/logo/icon.png"
24+
25+
PAYLOAD=$(jq -n \
26+
--arg name "$RAW_NAME" \
27+
--arg avatar_url "$RAW_AVATAR_URL" \
28+
--arg url "$HTML_URL" \
29+
--arg body "$RAW_BODY" \
30+
--arg color "2105893" \
31+
--arg footer_text "Changelog" \
32+
--arg timestamp "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
33+
'{
34+
username: "webpack Release Changelog",
35+
avatar_url: $avatar_url,
36+
content: "||<@&1450591255485743204>||",
37+
embeds: [{
38+
title: ($name | .[0:256]),
39+
url: $url,
40+
color: ($color | tonumber),
41+
description: ($body | .[0:4096]),
42+
footer: {
43+
text: ($footer_text | .[0:2048])
44+
},
45+
timestamp: $timestamp
46+
}]
47+
}')
2048
21-
echo "--- DEBUG: System Event File Content ($GITHUB_EVENT_PATH) ---"
22-
cat "$GITHUB_EVENT_PATH"
23-
echo "--------------------------------------------------------"
49+
curl -X POST -H "Content-Type: application/json" \
50+
-d "$PAYLOAD" \
51+
"${{ secrets.DISCORD_WEBHOOK }}"
2452
env:
2553
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
27-
- name: GitHub Releases to Discord
28-
uses: SethCohen/github-releases-to-discord@b96a33520f8ad5e6dcdecee6f1212bdf88b16550 # v1.19.0
29-
with:
30-
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
31-
color: "2105893"
32-
username: "webpack Release Changelog"
33-
avatar_url: "https://github.com/webpack/media/blob/90b54d02fa1cfc8aa864a8322202f74ac000f5d2/logo/icon.png"
34-
content: "||<@&1450591255485743204>||"
35-
footer_title: "Changelog"
36-
reduce_headings: true

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@
269269
"timestamping",
270270
"tmpl",
271271
"toplevel",
272+
"tonumber",
272273
"traceur",
273274
"transpile",
274275
"transpiled",

0 commit comments

Comments
 (0)