1
0
Fork 0

Bump some things

main
Ambrose Chua 2020-06-18 12:43:48 +08:00
parent 86e021cfcb
commit 7d59da852a
Signed by: ambrose
GPG Key ID: BC367D33F140B5C2
2 changed files with 53 additions and 1 deletions

View File

@ -15,7 +15,7 @@ brew "pinentry"
# languages
#brew "python3"
#brew "go"
#brew "node"
brew "node"
#brew "deno"
# system
#brew "grpc"

View File

@ -0,0 +1,52 @@
#!/bin/bash
DRONE_SERVER=${DRONE_SERVER:="https://ci.makerforce.io"}
DRONE_TOKEN=${DRONE_TOKEN:=""}
echo
echo "This script updates drone-gitea-release token on all Drone repos"
echo
path_to_httpie=$(which http)
if [ ! -x "$path_to_httpie" ] ; then
echo "HTTPie not installed. Please install it at (https://httpie.org/doc#installation)"
fi
path_to_jq=$(which jq)
if [ ! -x "$path_to_jq" ] ; then
echo "JQ not installed. Please install it at (https://stedolan.github.io/jq/download/)"
fi
if [ -z $DRONE_TOKEN ]; then
echo "Enter Drone token ($DRONE_SERVER/account/token)"
echo -n "> "
read DRONE_TOKEN
echo
fi
echo "Enter drone-gitea-release token"
echo -n "> "
read gitea_token
echo
echo
echo "Fetching repo list..."
repo_list=$(http GET $DRONE_SERVER/api/user/repos Authorization:"Bearer $DRONE_TOKEN" | jq .[].slug -r)
for r in $repo_list; do
echo "Updating gitea_token in $r..."
http --check-status -b PATCH \
$DRONE_SERVER/api/repos/$r/secrets/gitea_token \
Authorization:"Bearer $DRONE_TOKEN" \
data="$gitea_token" \
pull_request:=false \
|| http --check-status -b POST \
$DRONE_SERVER/api/repos/$r/secrets \
Authorization:"Bearer $DRONE_TOKEN" \
name="gitea_token" \
data="$gitea_token" \
pull_request:=false
done