1
0
Fork 0

ci: pushing statuses to Discord webhook

This commit is contained in:
Marc 2024-07-19 21:41:04 -04:00
parent b7b4e8b57b
commit 21a372aa71
Signed by: marc
GPG key ID: 048E042F22B5DC79
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,26 @@
inputs:
webhook-url:
description: "Discord webhook URL events should be sent to."
required: true
project-name:
description: "Project name."
required: true
status:
description: "Status to report."
required: true
outputs:
message-id:
description: "ID of the message that was posted, for editing purposes in further calls."
value: ""
run:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: pip install .
- run: python ./main.py ${{ inputs.webhook_url }} ${{ inputs.project_name }} ${{inputs.status }}

View file

@ -0,0 +1,8 @@
import httpx
import sys
if __name__ == "__main__":
webhook_url, project_name, status = sys.argv[1:]
response = httpx.post(webhook_url, json={"content": f"{project_name} - {status}"})
print(response.json())

View file

@ -2,6 +2,15 @@ on:
push:
jobs:
pre-run-notify:
runs-on: ubuntu-latest
steps:
- uses: ./.forgejo/actions/push-status-to-discord
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
project-name: ${{ github.repository }}
status: "Started"
sast:
runs-on: ubuntu-latest
steps: