Last active
December 1, 2020 08:44
-
-
Save pyohei/8732654c02c76d0ef1c6dfb1fa0e54f4 to your computer and use it in GitHub Desktop.
Delete Old Circle CI webhook url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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