diff --git a/delete-an-enterprise-repository-ruleset.sh b/delete-an-enterprise-repository-ruleset.sh new file mode 100755 index 0000000..4d7f96f --- /dev/null +++ b/delete-an-enterprise-repository-ruleset.sh @@ -0,0 +1,21 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#delete-an-enterprise-repository-ruleset +# DELETE /enterprises/{enterprise}/rulesets/{ruleset_id} + + +# If the script is passed an argument $1 use that as the name +if [ -z "$1" ] + then + ruleset_id=$() + else + ruleset_id=$1 +fi + +curl ${curl_custom_flags} \ + -X DELETE \ + -H "X-GitHub-Api-Version: ${github_api_version}" \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/enterprises/${enterprise}/rulesets/${ruleset_id}" + diff --git a/get-an-enterprise-repository-ruleset.sh b/get-an-enterprise-repository-ruleset.sh new file mode 100755 index 0000000..c4b4f77 --- /dev/null +++ b/get-an-enterprise-repository-ruleset.sh @@ -0,0 +1,21 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#get-an-enterprise-repository-ruleset +# GET /enterprises/{enterprise}/rulesets/{ruleset_id} + + +# If the script is passed an argument $1 use that as the name +if [ -z "$1" ] + then + ruleset_id=$() + else + ruleset_id=$1 +fi + + +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}/enterprises/${enterprise}/rulesets/${ruleset_id}" + diff --git a/get-enterprise-ruleset-history.sh b/get-enterprise-ruleset-history.sh new file mode 100755 index 0000000..a9e11a5 --- /dev/null +++ b/get-enterprise-ruleset-history.sh @@ -0,0 +1,21 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#get-enterprise-ruleset-history +# GET /enterprises/{enterprise}/rulesets/{ruleset_id}/history + + +# If the script is passed an argument $1 use that as the name +if [ -z "$1" ] + then + ruleset_id=$() + else + ruleset_id=$1 +fi + + +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}/enterprises/${enterprise}/rulesets/${ruleset_id}/history" + diff --git a/skeleton.sh b/skeleton.sh index ab23a59..e5f76ad 100755 --- a/skeleton.sh +++ b/skeleton.sh @@ -27,3 +27,4 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}" --data @${json_file} +