diff --git a/scripts/insert-nids.sh b/scripts/insert-nids.sh index 6822661..6276392 100755 --- a/scripts/insert-nids.sh +++ b/scripts/insert-nids.sh @@ -15,8 +15,16 @@ SHEET_ID=$(echo "$URL" | sed -n 's|.*/d/\(.*\)|\1|p') API_URL="https://sheets.googleapis.com/v4/spreadsheets/$SHEET_ID/values/Sheet1!D2:append" PAYLOAD=$(tail +4 /tmp/rollback.csv | jq -R '[.]' | jq -s '{"values": .}') -curl -v -s -X POST \ - --header "Authorization: Bearer $ACCESS_TOKEN" \ - --header "Content-Type: application/json" \ - --data @<(echo "$PAYLOAD") \ - "$API_URL?valueInputOption=RAW" +STATUS=$(curl -s -X POST \ + -o /tmp/gsup.log \ + -w '%{http_code}' \ + --header "Authorization: Bearer $ACCESS_TOKEN" \ + --header "Content-Type: application/json" \ + --data @<(echo "$PAYLOAD") \ + "$API_URL?valueInputOption=RAW") + +if [ "${STATUS}" != 200 ]; then + echo "Failed to update spreadsheet with node IDs" + cat /tmp/gsup.log + exit 1 +fi