dnscontrol-action/entrypoint.sh
2021-01-16 19:45:44 +01:00

22 lines
555 B
Bash
Executable file

#!/usr/bin/env bash
set -eo pipefail
# Resolve to full paths
CONFIG_ABS_PATH="$(readlink -f "${INPUT_CONFIG_FILE}")"
CREDS_ABS_PATH="$(readlink -f "${INPUT_CREDS_FILE}")"
WORKING_DIR="$(dirname "${CONFIG_ABS_PATH}")"
cd "$WORKING_DIR"
IFS=
OUTPUT="$(dnscontrol "$1" --config "$CONFIG_ABS_PATH" --creds "$CREDS_ABS_PATH")"
echo "$OUTPUT"
# https://github.community/t/set-output-truncates-multiline-strings/16852/3
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=output::$OUTPUT"