Ajouter action.yaml
This commit is contained in:
53
action.yaml
Normal file
53
action.yaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: 'Ping a Healthchecks.io server'
|
||||||
|
description: 'Description de l action'
|
||||||
|
author: 'Eric Coissac'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
server:
|
||||||
|
description: 'Address of the Healthchecks server'
|
||||||
|
required: true
|
||||||
|
uuid:
|
||||||
|
description: 'Deuxième paramètre'
|
||||||
|
required: true
|
||||||
|
command:
|
||||||
|
description: 'Command to sen to the server can be nothing, start, log or fail'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
message:
|
||||||
|
description: 'Message to log with the ping'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Ping the server
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
HEALTHPOINT="${{ inputs.server }}/${{ input.uuid }}"
|
||||||
|
OPTIONS="-fsS -m 10 --retry 5"
|
||||||
|
MESSAGE="${{ inputs.message }}"
|
||||||
|
COMMAND="${{ input.command }}"
|
||||||
|
|
||||||
|
if [[ -n "$MESSAGE" ]] ; then
|
||||||
|
MESSAGE="--data-raw \"${MESSAGE}\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$COMMAND" in
|
||||||
|
|
||||||
|
start | log | fail)
|
||||||
|
URL="${HEALTHPOINT}/$COMMAND"
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
URL="${HEALTHPOINT}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
RUN="curl $OPTIONS $MESSAGE '$URL'"
|
||||||
|
eval "$RUN"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user