Actualiser action.yaml
This commit is contained in:
15
action.yaml
15
action.yaml
@@ -25,6 +25,15 @@ runs:
|
|||||||
- name: Ping the server
|
- name: Ping the server
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
if [[ -z $(which curl) ]] ; then
|
||||||
|
echo -e "${RED}❌ Error:${NC}: Cannot locate the curl command"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
HEALTHPOINT="${{ inputs.server }}/ping/${{ inputs.uuid }}"
|
HEALTHPOINT="${{ inputs.server }}/ping/${{ inputs.uuid }}"
|
||||||
OPTIONS="-fsS -m 10 --retry 5"
|
OPTIONS="-fsS -m 10 --retry 5"
|
||||||
MESSAGE="${{ inputs.message }}"
|
MESSAGE="${{ inputs.message }}"
|
||||||
@@ -44,7 +53,7 @@ runs:
|
|||||||
URL="${HEALTHPOINT}"
|
URL="${HEALTHPOINT}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "::error::Commande invalide: $COMMAND"
|
echo "${RED}❌ Error:${NC}: Commande invalide: $COMMAND"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -58,7 +67,9 @@ runs:
|
|||||||
|
|
||||||
echo "Commande exécutée: ${curl_cmd[*]}"
|
echo "Commande exécutée: ${curl_cmd[*]}"
|
||||||
|
|
||||||
"${curl_cmd[@]}" # Exécution sans eval
|
"${curl_cmd[@]}" \
|
||||||
|
&& echo -e "${GREEN}✅ Success:${NC} ping sent to ${HEALTHPOINT}" \
|
||||||
|
|| echo -e "${RED}❌ Error: ${NC} ping to ${HEALTHPOINT} failed"
|
||||||
|
|
||||||
if [[ "$COMMAND" == "fail" ]] ; then
|
if [[ "$COMMAND" == "fail" ]] ; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user