Skip to content

Commit 5be856f

Browse files
authored
chore: add action posting to discord (#2486)
* add action posting to discord Signed-off-by: Michele Dolfi <[email protected]> * test on push Signed-off-by: Michele Dolfi <[email protected]> * with icon Signed-off-by: Michele Dolfi <[email protected]> * remove testing Signed-off-by: Michele Dolfi <[email protected]> --------- Signed-off-by: Michele Dolfi <[email protected]>
1 parent dd03b53 commit 5be856f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# .github/workflows/discord-release.yml
2+
name: Notify Discord on Release
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
discord:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Send release info to Discord
13+
env:
14+
DISCORD_WEBHOOK: ${{ secrets.RELEASES_DISCORD_WEBHOOK }}
15+
run: |
16+
REPO_NAME=${{ github.repository }}
17+
RELEASE_TAG=${{ github.event.release.tag_name }}
18+
RELEASE_NAME="${{ github.event.release.name }}"
19+
RELEASE_URL=${{ github.event.release.html_url }}
20+
RELEASE_BODY="${{ github.event.release.body }}"
21+
22+
# Fallback if release name is empty
23+
if [ -z "$RELEASE_NAME" ]; then
24+
RELEASE_NAME=$RELEASE_TAG
25+
fi
26+
27+
PAYLOAD=$(jq -n \
28+
--arg title "🚀 New Release: $RELEASE_NAME" \
29+
--arg url "$RELEASE_URL" \
30+
--arg desc "$RELEASE_BODY" \
31+
--arg author_name "$REPO_NAME" \
32+
--arg author_icon "https://github.com/docling-project.png" \
33+
'{embeds: [{title: $title, url: $url, description: $desc, color: 5814783, author: {name: $author_name, icon_url: $author_icon}}]}')
34+
35+
curl -H "Content-Type: application/json" \
36+
-d "$PAYLOAD" \
37+
"$DISCORD_WEBHOOK"

0 commit comments

Comments
 (0)