feat: setup script to sync repos #114
1 changed files with 3 additions and 3 deletions
|
@ -4,14 +4,14 @@ Mirror-Clear(){
|
||||||
# existing remotes
|
# existing remotes
|
||||||
local id=$(tr -d '\n\t\r ' <<<"${1}" )
|
local id=$(tr -d '\n\t\r ' <<<"${1}" )
|
||||||
local token=$(tr -d '\n\t\r ' <<<"$TOKEN" )
|
local token=$(tr -d '\n\t\r ' <<<"$TOKEN" )
|
||||||
local response=$(curl -X "GET" "https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors" --header "PRIVATE-TOKEN: $token")
|
local response=$(curl -s -X "GET" "https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors" --header "PRIVATE-TOKEN: $token")
|
||||||
|
|
||||||
# https://stackoverflow.com/a/67638584
|
# https://stackoverflow.com/a/67638584
|
||||||
readarray -t my_array < <(jq -c '.[]' <<< $response)
|
readarray -t my_array < <(jq -c '.[]' <<< $response)
|
||||||
# iterate through the Bash array
|
# iterate through the Bash array
|
||||||
for item in "${my_array[@]}"; do
|
for item in "${my_array[@]}"; do
|
||||||
local id_mirror=$(jq --raw-output '.id' <<< "$item")
|
local id_mirror=$(jq --raw-output '.id' <<< "$item")
|
||||||
curl -X "DELETE" "https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors/$id_mirror" --header "PRIVATE-TOKEN: $token"
|
curl -s -X "DELETE" "https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors/$id_mirror" --header "PRIVATE-TOKEN: $token"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Mirror-Create(){
|
||||||
local uri="https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors"
|
local uri="https://gitlab.skynet.ie/api/v4/projects/$id/remote_mirrors"
|
||||||
echo $uri
|
echo $uri
|
||||||
local tmp=""
|
local tmp=""
|
||||||
curl -X "POST" "$uri" --header "PRIVATE-TOKEN: $token" --data $body
|
curl -s -X "POST" "$uri" --header "PRIVATE-TOKEN: $token" --data $body
|
||||||
}
|
}
|
||||||
|
|
||||||
Main() {
|
Main() {
|
||||||
|
|
Loading…
Reference in a new issue