push-status-to-discord-action/action.yml

40 lines
1.3 KiB
YAML

name: Post build status to Discord
inputs:
webhook-url:
description: "Discord webhook URL events should be sent to."
required: true
title:
description: "Message title"
default: "${{github.repository}} (Build #${{github.run_number}})"
status:
description: "Status to report."
required: true
variant:
description: "Style to attach to the message element."
default: "info"
init:
description: "Marks the first status push, prevents pulling context."
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: actions/download-artifact@v3
if: ${{ !inputs.init }}
with:
name: "${{github.sha}}-${{github.run_number}}-${{github.run_attempt}}-discord-context.zip"
path: /tmp
- name: Install dependencies
if: ${{ always() }}
run: pip install -r ${{ github.action_path }}/requirements.txt
- run: python ${{ github.action_path }}/main.py ${{ inputs.webhook-url }} "${{inputs.title}}" ${{ inputs.status }} ${{ inputs.variant }} /tmp/discord-context
- uses: actions/upload-artifact@v3
with:
path: /tmp/discord-context
name: "${{github.sha}}-${{github.run_number}}-${{github.run_attempt}}-discord-context.zip"
retention-days: 1
overwrite: true