More silencing of output

This commit is contained in:
Marcus Noble 2020-12-13 16:39:37 +00:00
parent a610e1f2ef
commit f5b169997b

17
sync.sh
View File

@ -19,24 +19,27 @@ getDefaultBranch() {
} }
githubGetRepo() { githubGetRepo() {
curl -f -u averagemarcus:${GITHUB_TOKEN} "https://api.github.com/repos/averagemarcus/${1}" -H "accept: application/vnd.github.v3+json" 1> /dev/null curl -f -u averagemarcus:${GITHUB_TOKEN} "https://api.github.com/repos/averagemarcus/${1}" -H "accept: application/vnd.github.v3+json" --silent 1> /dev/null
} }
githubMakeRepo() { githubMakeRepo() {
curl -X POST -f -u averagemarcus:${GITHUB_TOKEN} "https://api.github.com/user/repos" -H "accept: application/vnd.github.v3+json" -d '{"name": "'${1}'", "private": false, "auto_init": false, "delete_branch_on_merge": true}' 1> /dev/null echo "Creating github repo"
curl -X POST -f -u averagemarcus:${GITHUB_TOKEN} "https://api.github.com/user/repos" -H "accept: application/vnd.github.v3+json" -d '{"name": "'${1}'", "private": false, "auto_init": false, "delete_branch_on_merge": true}' --silent 1> /dev/null
} }
bitbucketGetRepo() { bitbucketGetRepo() {
curl -f -u averagemarcus:${BITBUCKET_TOKEN} "https://api.bitbucket.org/2.0/repositories/averagemarcus/${1}" 1> /dev/null curl -f -u averagemarcus:${BITBUCKET_TOKEN} "https://api.bitbucket.org/2.0/repositories/averagemarcus/${1}" --silent 1> /dev/null
} }
bitbucketMakeRepo() { bitbucketMakeRepo() {
curl -X POST -u averagemarcus:${BITBUCKET_TOKEN} -H "Content-Type: application/json" -d '{"scm": "git", "is_private": false,"project": {"key": "PROJ"}}' "https://api.bitbucket.org/2.0/repositories/averagemarcus/${1}" 1> /dev/null echo "Creating bitbucket repo"
curl -X POST -u averagemarcus:${BITBUCKET_TOKEN} -H "Content-Type: application/json" -d '{"scm": "git", "is_private": false,"project": {"key": "PROJ"}}' "https://api.bitbucket.org/2.0/repositories/averagemarcus/${1}" --silent1> /dev/null
} }
gitlabGetRepo() { gitlabGetRepo() {
curl -f "https://gitlab.com/api/v4/projects/averagemarcus/${1}?private_token=${GITLAB_TOKEN}" 1> /dev/null curl -f "https://gitlab.com/api/v4/projects/averagemarcus/${1}?private_token=${GITLAB_TOKEN}" --silent 1> /dev/null
} }
gitlabMakeRepo() { gitlabMakeRepo() {
curl -X POST --header "Content-Type: application/json" "https://gitlab.com/api/v4/projects?private_token=${GITLAB_TOKEN}" -d '{"name": "'${1}'", "visibility": "public"}' 1> /dev/null echo "Creating gitlab repo"
curl -X POST --header "Content-Type: application/json" "https://gitlab.com/api/v4/projects?private_token=${GITLAB_TOKEN}" -d '{"name": "'${1}'", "visibility": "public"}' --silent 1> /dev/null
} }
for REPO in ${REPOS}; do for REPO in ${REPOS}; do
@ -86,3 +89,5 @@ then
printf ${FAILED_MESSAGE} printf ${FAILED_MESSAGE}
exit 1 exit 1
fi fi
exit 0