mirror of https://github.com/glanceapp/glance.git
Kolejne poprawki:
- brak nadpisywania przez action profilowego webhooka - wszytko teraz jest w jednym action - webhook wysyla powiadomienie dopiero jak obraz dockera sie zbudujepull/878/head
parent
8706a1728d
commit
f43be6f40b
@ -1,57 +0,0 @@
|
|||||||
name: Powiadomienie Discord
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
notify:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Wyślij powiadomienie na Discord
|
|
||||||
env:
|
|
||||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
||||||
COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
|
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
||||||
COMMIT_URL: ${{ github.event.head_commit.url }}
|
|
||||||
REPO_NAME: ${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
if [ -z "$DISCORD_WEBHOOK" ]; then
|
|
||||||
echo "Błąd: Sekret DISCORD_WEBHOOK nie jest ustawiony."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Budowanie bezpiecznego JSON-a za pomocą jq
|
|
||||||
PAYLOAD=$(jq -n \
|
|
||||||
--arg author "$COMMIT_AUTHOR" \
|
|
||||||
--arg msg "$COMMIT_MESSAGE" \
|
|
||||||
--arg url "$COMMIT_URL" \
|
|
||||||
--arg repo "$REPO_NAME" \
|
|
||||||
'{
|
|
||||||
username: "GitHub Actions",
|
|
||||||
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
|
||||||
embeds: [{
|
|
||||||
title: ("Nowy commit w " + $repo + " 🚀"),
|
|
||||||
url: $url,
|
|
||||||
color: 5814783,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Autor",
|
|
||||||
value: $author,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Wiadomość",
|
|
||||||
value: $msg
|
|
||||||
}
|
|
||||||
],
|
|
||||||
footer: {
|
|
||||||
text: "GitHub Actions"
|
|
||||||
},
|
|
||||||
timestamp: now | todate
|
|
||||||
}]
|
|
||||||
}')
|
|
||||||
|
|
||||||
# Wysłanie żądania do Discorda
|
|
||||||
echo "$PAYLOAD" | curl -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK"
|
|
||||||
Loading…
Reference in New Issue