Skip to content

Commit

Permalink
Check status
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Dec 4, 2024
1 parent d8f9dcb commit af7f9c6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions scripts/insert-nids.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit af7f9c6

Please sign in to comment.