Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a41f6aefa0 | |||
| 93da623c4b | |||
| e034844ea1 | |||
| dff6f3022a |
3 changed files with 22 additions and 12 deletions
13
README.md
13
README.md
|
|
@ -1,4 +1,15 @@
|
||||||
Notifies using ntfy
|
Notifies using ntfy
|
||||||
===================
|
===================
|
||||||
|
|
||||||
I don't know what I'm doing yet
|
Usage:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Notify
|
||||||
|
uses: https://git.lerch.org/lobo/action-notify-ntfy@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.NTFY_HOST }}
|
||||||
|
topic: ${{ secrets.NTFY_TOPIC }}
|
||||||
|
user: ${{ secrets.NTFY_USER }}
|
||||||
|
password: ${{ secrets.NTFY_PASSWORD }}
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,9 @@ inputs:
|
||||||
topic:
|
topic:
|
||||||
description: 'Ntfy topic'
|
description: 'Ntfy topic'
|
||||||
required: true
|
required: true
|
||||||
# status:
|
status:
|
||||||
# description: 'Job status. Use ${{ job.status }} for most cases'
|
description: 'Job status. Use expression {{ job.status }} for most cases'
|
||||||
# required: true
|
required: true
|
||||||
# default: '${{ job.status }}'
|
|
||||||
user:
|
user:
|
||||||
description: 'Username for ntfy server'
|
description: 'Username for ntfy server'
|
||||||
required: true # should be false, but we'll do authenticated sessions only for now
|
required: true # should be false, but we'll do authenticated sessions only for now
|
||||||
|
|
@ -22,4 +21,4 @@ runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
args:
|
args:
|
||||||
- ${{ job.status }}
|
- ${{ inputs.status }}
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,23 @@ echo "Notifying job status: $1"
|
||||||
|
|
||||||
if [ "$1" = "success" ]; then
|
if [ "$1" = "success" ]; then
|
||||||
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
||||||
-H "Title: Job Succeeded. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
-H "Title: Job ${GITHUB_JOB} Succeeded. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
||||||
-H "Tags: +1" \
|
-H "Tags: +1" \
|
||||||
-d "Job succeeded. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
-d "Job ${GITHUB_JOB} succeeded. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
||||||
"${INPUT_HOST}${INPUT_TOPIC}"
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
||||||
elif [ "$1" = "failure" ]; then
|
elif [ "$1" = "failure" ]; then
|
||||||
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
||||||
-H "Title: Job FAILED. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
-H "Title: Job ${GITHUB_JOB} FAILED. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
||||||
-H "Priority: high" \
|
-H "Priority: high" \
|
||||||
-H "Tags: warning" \
|
-H "Tags: warning" \
|
||||||
-d "Job failed. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
-d "Job ${GITHUB_JOB} failed. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
||||||
"${INPUT_HOST}${INPUT_TOPIC}"
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
||||||
elif [ "$1" = "cancelled" ]; then
|
elif [ "$1" = "cancelled" ]; then
|
||||||
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
curl -s -u "${INPUT_USER}:${INPUT_PASSWORD}" \
|
||||||
-H "Title: Job cancelled. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
-H "Title: Job ${GITHUB_JOB} cancelled. ${GITHUB_REPOSITORY}/${GITHUB_REF}" \
|
||||||
-H "Priority: low" \
|
-H "Priority: low" \
|
||||||
-H "Tags: x" \
|
-H "Tags: x" \
|
||||||
-d "Job cancelled. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
-d "Job ${GITHUB_JOB} cancelled. See $GITHUB_SERVER_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_NUMBER} for details" \
|
||||||
"${INPUT_HOST}${INPUT_TOPIC}"
|
"${INPUT_HOST}${INPUT_TOPIC}"
|
||||||
else
|
else
|
||||||
echo "Unknown job status $1"
|
echo "Unknown job status $1"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue