Skip to content

Add new line to sticky/test53354 #6

Add new line to sticky/test53354

Add new line to sticky/test53354 #6

name: Sticky Discord Notification
on:
push:
branches:
- main
- master
paths:
- "sticky/**"
jobs:
discord:
runs-on: ubuntu-latest
steps:
- name: Send latest Sticky commit to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_STICKY }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_URL: ${{ github.event.head_commit.html_url }}
AUTHOR: ${{ github.event.head_commit.author.name }}
BRANCH: ${{ github.ref_name }}
run: |
python3 - <<'PY'
import json
import os
import urllib.request
payload = {
"username": "GitHub Sticky",
"embeds": [{
"title": "New Sticky Update",
"description": os.environ["COMMIT_MESSAGE"][:4000],
"url": os.environ["COMMIT_URL"],
"color": 5814783,
"fields": [
{
"name": "Author",
"value": os.environ["AUTHOR"] or "Unknown",
"inline": True
},
{
"name": "Branch",
"value": os.environ["BRANCH"],
"inline": True
}
]
}]
}
request = urllib.request.Request(
os.environ["DISCORD_WEBHOOK"],
data=json.dumps(payload).encode("utf-8"),
headers={"Content-Type": "application/json"},
method="POST"
)
with urllib.request.urlopen(request) as response:
if response.status not in (200, 204):
raise RuntimeError(
f"Discord returned HTTP {response.status}"
)
PY