fix: agree with shellcheck

This commit is contained in:
Tibo De Peuter 2026-08-05 20:27:32 +02:00
parent 58effd5966
commit de45fc0103
Signed by: tdpeuter
SSH key fingerprint: SHA256:u/h/LVoqKF1Iz02uOyxe6hcjmoZASCGV2HM0TG9ZMoU

View file

@ -20,7 +20,7 @@ fi
# We only care about PR events # We only care about PR events
if [[ "$ACTION" != "opened" && "$ACTION" != "reopened" && "$ACTION" != "synchronized" && "$ACTION" != "closed" ]]; then if [[ "$ACTION" != "opened" && "$ACTION" != "reopened" && "$ACTION" != "synchronized" && "$ACTION" != "closed" ]]; then
printf "Ignoring PR action: %%s\n" "$ACTION" printf "Ignoring PR action: %s\n" "$ACTION"
exit 0 exit 0
fi fi
@ -39,17 +39,17 @@ get_latest_snapshot() {
curl -sS -k -X GET \ curl -sS -k -X GET \
-H "Authorization: Bearer ${TRUENAS_API_KEY}" \ -H "Authorization: Bearer ${TRUENAS_API_KEY}" \
-H "Accept: application/json" \ -H "Accept: application/json" \
"${TRUENAS_URL}/api/v2.0/zfs/snapshot?id~=${ZFS_DATASET}%%25&limit=1&sort=-creation" | jq -r '.[0].id' "${TRUENAS_URL}/api/v2.0/zfs/snapshot?id~=${ZFS_DATASET}%25&limit=1&sort=-creation" | jq -r '.[0].id'
} }
printf "Processing PR #%%s (Action: %%s)\n" "$PR_NUMBER" "$ACTION" printf "Processing PR #%s (Action: %s)\n" "$PR_NUMBER" "$ACTION"
if [[ "$ACTION" == "closed" ]]; then if [[ "$ACTION" == "closed" ]]; then
if [ ! -d "$WORKSPACE" ]; then if [ ! -d "$WORKSPACE" ]; then
printf "Workspace %%s does not exist. Nothing to destroy.\n" "$WORKSPACE" printf "Workspace %s does not exist. Nothing to destroy.\n" "$WORKSPACE"
exit 0 exit 0
fi fi
printf "Destroying Staging Environment for PR #%%s...\n" "$PR_NUMBER" printf "Destroying Staging Environment for PR #%s...\n" "$PR_NUMBER"
cd "$WORKSPACE" cd "$WORKSPACE"
tofu destroy -var="pr_number=${PR_NUMBER}" -auto-approve tofu destroy -var="pr_number=${PR_NUMBER}" -auto-approve
@ -61,7 +61,7 @@ if [[ "$ACTION" == "closed" ]]; then
fi fi
# Provisioning (opened, reopened, synchronized) # Provisioning (opened, reopened, synchronized)
printf "Setting up Staging Environment for PR #%%s...\n" "$PR_NUMBER" printf "Setting up Staging Environment for PR #%s...\n" "$PR_NUMBER"
if [ ! -d "$WORKSPACE" ]; then if [ ! -d "$WORKSPACE" ]; then
mkdir -p "$WORKSPACE" mkdir -p "$WORKSPACE"
@ -78,7 +78,7 @@ if [ -z "$LATEST_SNAPSHOT" ] || [ "$LATEST_SNAPSHOT" == "null" ]; then
exit 1 exit 1
fi fi
printf "Latest Snapshot ID: %%s\n" "$LATEST_SNAPSHOT" printf "Latest Snapshot ID: %s\n" "$LATEST_SNAPSHOT"
# Apply OpenTofu # Apply OpenTofu
tofu init -upgrade tofu init -upgrade