push-status-to-discord-action/README.md

57 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2024-07-20 03:20:23 +00:00
# push-status-to-discord-action
## Overview
Posts build statuses to Discord via webhooks. If a message ID is provided when invoking, the specified message will be edited instead of creating a new one, keeping reporting channels tidy.
## Inputs & outputs
```yaml
inputs:
webhook-url:
description: "Discord webhook url messages should be sent to."
required: true
title:
description: "Discord message title."
default: "${{github.repository}} (Build #${{github.run_number}})"
status:
description: "Status to report."
required: true
variant:
# See main.py for pre-defined variants.
description: "Style to attach to the message element."
default: "info"
message-id:
description: "Message ID to post to. If specified, the message will be updated instead of creating a new one."
outputs:
message-id:
description: "ID of the message created or edited."
```
## Usage
Unless a `message-id` input is provided, new messages are created on every invocation. The message ID can be passed around between jobs using the `@actions/upload-artifact` and `@actions/download-artifact` actions:
```yaml
jobs:
job1:
- uses: https://forge.karnov.club/marc/push-status-to-discord@main
id: post-message
- run: echo "${{ steps.post-message.outputs.message-id }}" >> /tmp/some-file
- uses: @actions/upload-artifact
with:
path: /tmp/some-file
name: some-name
job2:
- uses: @actions/download-artifact
with:
path: /tmp
name: some-name
- run: echo "message-id=$(cat /tmp/some-file)" >> $GITHUB_OUTPUT
id: get-message-id
- uses: https://forge.karnov.club/marc/push-status-to-discord@main
with:
message-id: ${{ steps.get-message-id.outputs.message-id }}
```