diff --git a/.forgejo/actions/push-status-to-discord/action.yml b/.forgejo/actions/push-status-to-discord/action.yml new file mode 100644 index 0000000..05afb38 --- /dev/null +++ b/.forgejo/actions/push-status-to-discord/action.yml @@ -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 }} diff --git a/.forgejo/actions/push-status-to-discord/main.py b/.forgejo/actions/push-status-to-discord/main.py new file mode 100644 index 0000000..115ff11 --- /dev/null +++ b/.forgejo/actions/push-status-to-discord/main.py @@ -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()) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 96bf200..9b4ad99 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -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: