Gogs changes, hcl

This commit is contained in:
2019-01-24 18:29:20 +01:00
parent d7aa0e3e54
commit aa9923a2be
3 changed files with 12 additions and 6 deletions

View File

@ -38,6 +38,7 @@ fi
create-repo() {
local user_name=$1 # name of the user / organization where the repo will be created
local repo_name=$2 # name of the repo to be created
local repo_desc=$3
# ensure user_name is passed in
if [ -z $user_name ]
@ -66,7 +67,8 @@ create-repo() {
local body=$(cat <<-END
{
"name": "$repo_name",
"private": false
"private": true,
"description": "$repo_desc"
}
END
)
@ -74,7 +76,8 @@ create-repo() {
curl -H "Content-Type: application/json" \
-H "Authorization: token $GOGS_TOKEN" \
-d "$body" \
-v $GOGS_ROOT_URL/api/v1/admin/users/$user_name/repos
$GOGS_ROOT_URL/api/v1/admin/users/$user_name/repos |jq
}
# create a GOGS webhook
@ -137,7 +140,7 @@ create-webhook() {
curl -H "Content-Type: application/json" \
-H "Authorization: token $GOGS_TOKEN" \
-d "$body" \
-v $GOGS_ROOT_URL/api/v1/repos/$user_name/$repo_name/hooks
$GOGS_ROOT_URL/api/v1/repos/$user_name/$repo_name/hooks
}
# delete a GOGS webhook for a repo
@ -256,12 +259,13 @@ help() {
Usage:
$prog_name $1 <user_name> <repo_name>
$prog_name $1 <user_name> <repo_name> <repo_desc>
Arguments:
user_name name of the user or organization where the repo will be created
repo_name name of the repository to be created
repo_desc repository description
END
;;