Skip to content

Commit

Permalink
Adding create a custom repository role
Browse files Browse the repository at this point in the history
  • Loading branch information
gm3dmo committed Apr 18, 2023
1 parent cc339e0 commit 5db7809
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions create-a-custom-repository-role.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#create-a-custom-repository-role
# POST /orgs/{org}/custom-repository-roles



json_file=tmp/create-a-custom-repository-role.json



name="labeler"
description="A role for issue and pull request labelers"
base_role="read"

jq -n \
--arg name "${name}" \
--arg description "${description}" \
--arg base_role "${base_role}" \
'{
name : $name,
name : $description,
base_role: $base_role,
"permissions": [
"add_label"
]
}' > ${json_file}



curl ${curl_custom_flags} \
-H "X-GitHub-Api-Version: ${github_api_version}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
${GITHUB_API_BASE_URL}/orgs/${org}/custom-repository-roles --data @${json_file}

0 comments on commit 5db7809

Please sign in to comment.