ci: pushing statuses to Discord webhook
This commit is contained in:
parent
b7b4e8b57b
commit
21a372aa71
3 changed files with 43 additions and 0 deletions
26
.forgejo/actions/push-status-to-discord/action.yml
Normal file
26
.forgejo/actions/push-status-to-discord/action.yml
Normal 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 }}
|
8
.forgejo/actions/push-status-to-discord/main.py
Normal file
8
.forgejo/actions/push-status-to-discord/main.py
Normal 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())
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue