Skip to content

Instantly share code, notes, and snippets.

@pyohei
Last active December 1, 2020 08:44
Show Gist options
  • Save pyohei/8732654c02c76d0ef1c6dfb1fa0e54f4 to your computer and use it in GitHub Desktop.
Save pyohei/8732654c02c76d0ef1c6dfb1fa0e54f4 to your computer and use it in GitHub Desktop.
Delete Old Circle CI webhook url.
#!/bin/bash
VSC=github
ORG=xxxxxxxx
CIRCLE_TOKEN=xxxxxxxxx
CIRCLE_API_BASE=https://circleci.com/api/v1.1
REPOSITORIES=`curl -s ${CIRCLE_API_BASE}/projects -H "Circle-Token: ${CIRCLE_TOKEN}" | grep "reponame" | cut -d '"' -f 4`
# Update webhook url
echo '---- Update Webhook URL ----'
for r in ${REPOSITORIES}
do
echo $r
curl -X PUT "${CIRCLE_API_BASE}/project/${VSC}/${ORG}/${r}/settings" \
-H 'Content-Type: application/json' \
-H "Circle-Token: ${CIRCLE_TOKEN}" \
--data-binary '{"slack_webhook_url":""}'
sleep 1
done
# Check webhook url
echo '---- Check Webhook URL ----'
for r in ${REPOSITORIES}
do
echo $r
curl -s -X GET -H "Circle-Token: ${CIRCLE_TOKEN}" \
"${CIRCLE_API_BASE}/project/github/CreditEngine/${r}/settings" \
| grep 'slack_webhook_url'
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment