feat: setup script to sync repos #114

Merged
silver merged 8 commits from #50_mirror_using_gitlab.com into main 2023-12-27 22:22:17 +00:00
Showing only changes of commit 0fc2b7ee6a - Show all commits

View file

@ -17,14 +17,13 @@ Mirror-Create(){
# make sure the values are clean of extra characters # make sure the values are clean of extra characters
local ID=${1} local ID=${1}
local REPO_TMP=$(tr -d '\n\t\r ' <<<"${2}" ) local REPO_TMP=$(tr -d '\n\t\r ' <<<"${2}" )
local token=$(tr -d '\n\t\r ' <<<"$TOKEN" )
local REPO=${REPO_TMP#"https://"} local REPO=${REPO_TMP#"https://"}
local body="url=https://oauth2:$token@$REPO&enabled=true&only_protected_branches=false&keep_divergent_refs=false" local body="url=https://oauth2:$TOKEN_REMOTE@$REPO&enabled=true&only_protected_branches=false&keep_divergent_refs=false"
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 -sS -X "POST" "$uri" --header "PRIVATE-TOKEN: $token" --data $body > tmp curl -sS -X "POST" "$uri" --header "PRIVATE-TOKEN: $TOKEN" --data $body > tmp
} }
Main() { Main() {