Fix: read NTFY_TOKEN from inherited env first, input as fallback
This commit is contained in:
+4
-4
@@ -10,7 +10,7 @@ inputs:
|
|||||||
description: 'ntfy topic'
|
description: 'ntfy topic'
|
||||||
required: true
|
required: true
|
||||||
ntfy_token:
|
ntfy_token:
|
||||||
description: 'ntfy auth token (bearer). Store in CI secret.'
|
description: 'ntfy auth token (bearer). Store in CI secret and pass via env:'
|
||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
status:
|
status:
|
||||||
@@ -28,7 +28,6 @@ runs:
|
|||||||
env:
|
env:
|
||||||
NTFY_URL: ${{ inputs.ntfy_url }}
|
NTFY_URL: ${{ inputs.ntfy_url }}
|
||||||
NTFY_TOPIC: ${{ inputs.ntfy_topic }}
|
NTFY_TOPIC: ${{ inputs.ntfy_topic }}
|
||||||
NTFY_TOKEN: ${{ inputs.ntfy_token }}
|
|
||||||
MESSAGE: ${{ inputs.message }}
|
MESSAGE: ${{ inputs.message }}
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ inputs.status }}" = "failure" ]; then
|
if [ "${{ inputs.status }}" = "failure" ]; then
|
||||||
@@ -39,8 +38,9 @@ runs:
|
|||||||
TAGS="rocket,white_check_mark,🎉,docker"
|
TAGS="rocket,white_check_mark,🎉,docker"
|
||||||
fi
|
fi
|
||||||
AUTH=()
|
AUTH=()
|
||||||
if [ -n "${NTFY_TOKEN}" ]; then
|
TOKEN="${NTFY_TOKEN:-${{ inputs.ntfy_token }}}"
|
||||||
AUTH=(-H "Authorization: Bearer ${NTFY_TOKEN}")
|
if [ -n "$TOKEN" ]; then
|
||||||
|
AUTH=(-H "Authorization: Bearer ${TOKEN}")
|
||||||
fi
|
fi
|
||||||
curl -sf \
|
curl -sf \
|
||||||
-H "Title: CI Notification" \
|
-H "Title: CI Notification" \
|
||||||
|
|||||||
Reference in New Issue
Block a user