From 13696f5b74a651bfe67c2237ffba254c877c6257 Mon Sep 17 00:00:00 2001 From: David Morris Date: Thu, 30 Jan 2025 20:43:59 +0000 Subject: [PATCH 1/2] Working on the great tidyadation #263 --- ...mail-address-for-the-authenticated-user.sh | 10 +++------- add-badteam-to-repo.sh | 3 ++- add-maintainers-to-team.sh | 2 +- add-many-owners-one-organization.sh | 2 +- add-many-users-to-org.sh | 2 +- add-many-users-to-team.sh | 2 +- add-or-update-team-repository-permissions.sh | 6 +----- add-owner-to-many-organizations.sh | 1 - add-repository-to-an-app-installation.sh | 4 ++-- add-team-to-org-project.sh | 4 ++-- add-team-to-repo.sh | 1 + add-user-access-restrictions.sh | 5 +---- add-user-to-org.sh | 3 +-- add-user-to-team.sh | 5 +++-- add-users-to-org.sh | 2 +- add-users-to-team.sh | 3 ++- get-a-pull-request.sh | 20 +++++++++++++++++++ get-all-repository-topics.sh | 11 ++++++++++ ...ons-accessible-to-the-user-access-token.sh | 11 ++++++++++ list-codes-of-conduct.sh | 5 +++-- list-organization-projects.sh | 13 ++++++------ list-project-columns.sh | 6 +++--- list-projects.sh | 1 - list-pull-request.sh | 10 ++++++---- ...-pull-requests-associated-with-a-commit.sh | 4 ++-- list-release-assets.sh | 9 +++++---- list-repo-topics.sh | 4 ++-- ...ies-accessible-to-the-user-access-token.sh | 2 +- list-repository-projects.sh | 6 +++--- list-reviews-for-a-pull-request.sh | 12 +++++++++++ list-reviews-for-pull-request.sh | 7 +++---- list-user-installations.sh | 6 +++--- org-members-can-create-repositories.sh | 15 +++++++------- remove-repository-from-an-app-installation.sh | 6 +++--- replace-repo-topics.sh | 12 ++++------- search-api-commits.sh | 2 -- set-branch-protection.sh | 11 ++++------ tiny-call-get-installation-token.sh | 14 ++++++------- tiny-create-check-run-with-annotation.sh | 17 +++++++--------- ...reate-check-run-with-conclusion-success.sh | 10 +++++----- tiny-create-check-run-with-conclusion.sh | 12 +++++------ tiny-get-an-app.sh | 2 -- tiny-get-webhook-configuration-for-an-app.sh | 6 +++--- tiny-list-app-installations.sh | 7 +++---- tiny-suspend-app-installation.sh | 7 ++++--- tiny-unsuspend-app-installation.sh | 6 +++--- tiny-update-a-check-run.sh | 5 ++--- update-a-pull-request-branch.sh | 7 +++---- update-badteam-repository.sh | 3 +-- ...e-branch-protection-with-required-check.sh | 6 +++--- update-team-repository.sh | 8 ++++---- 51 files changed, 183 insertions(+), 155 deletions(-) create mode 100755 get-a-pull-request.sh create mode 100755 get-all-repository-topics.sh create mode 100755 list-app-installations-accessible-to-the-user-access-token.sh create mode 100755 list-reviews-for-a-pull-request.sh diff --git a/add-an-email-address-for-the-authenticated-user.sh b/add-an-email-address-for-the-authenticated-user.sh index 6352819d..78eb1447 100755 --- a/add-an-email-address-for-the-authenticated-user.sh +++ b/add-an-email-address-for-the-authenticated-user.sh @@ -4,11 +4,11 @@ # POST /user/emails -json_file=tmp/skeleton.json - ts=$(date +%s) emails="test+n${ts}@example.com" +json_file=tmp/add-an-email-address-for-the-authenticated-user.json + jq -n \ --arg emails "${emails}" \ '{ @@ -16,13 +16,9 @@ jq -n \ }' > ${json_file} -cat $json_file | jq -r - 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}/user/emails --data @${json_file} - - + "${GITHUB_API_BASE_URL}/user/emails" --data @${json_file} diff --git a/add-badteam-to-repo.sh b/add-badteam-to-repo.sh index a0e01e76..2636227c 100755 --- a/add-badteam-to-repo.sh +++ b/add-badteam-to-repo.sh @@ -9,4 +9,5 @@ curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo} + "${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo}" + diff --git a/add-maintainers-to-team.sh b/add-maintainers-to-team.sh index 98954257..19621b97 100755 --- a/add-maintainers-to-team.sh +++ b/add-maintainers-to-team.sh @@ -8,4 +8,4 @@ team_id=$(curl ${curl_custom_flags} -H "Authorization: Bearer ${GITHUB_TOKEN}" $ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_admin} --data '{ "role": "maintainer"}' + "${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_admin}" --data '{ "role": "maintainer"}' diff --git a/add-many-owners-one-organization.sh b/add-many-owners-one-organization.sh index e7c00a87..9399e397 100755 --- a/add-many-owners-one-organization.sh +++ b/add-many-owners-one-organization.sh @@ -9,5 +9,5 @@ do -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${user} --data '{"role": "admin"}' + "${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${user}" --data '{"role": "admin"}' done diff --git a/add-many-users-to-org.sh b/add-many-users-to-org.sh index 33fc0f44..904977a7 100755 --- a/add-many-users-to-org.sh +++ b/add-many-users-to-org.sh @@ -11,5 +11,5 @@ do -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${person} + "${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${person}" done diff --git a/add-many-users-to-team.sh b/add-many-users-to-team.sh index 86c0e05c..49df97da 100755 --- a/add-many-users-to-team.sh +++ b/add-many-users-to-team.sh @@ -14,5 +14,5 @@ do -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_member} + "${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_member}" done diff --git a/add-or-update-team-repository-permissions.sh b/add-or-update-team-repository-permissions.sh index d7e3af9c..505b18c5 100755 --- a/add-or-update-team-repository-permissions.sh +++ b/add-or-update-team-repository-permissions.sh @@ -26,8 +26,4 @@ curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo} --data @${json_file} - - - - + "${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo}" --data @${json_file} diff --git a/add-owner-to-many-organizations.sh b/add-owner-to-many-organizations.sh index 5477199c..9cf82aeb 100755 --- a/add-owner-to-many-organizations.sh +++ b/add-owner-to-many-organizations.sh @@ -10,5 +10,4 @@ do -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${user}" --data '{"role": "admin"}' - done diff --git a/add-repository-to-an-app-installation.sh b/add-repository-to-an-app-installation.sh index 7ab5b6b5..dafe1ca0 100755 --- a/add-repository-to-an-app-installation.sh +++ b/add-repository-to-an-app-installation.sh @@ -10,6 +10,6 @@ installation_id=${default_installation_id} curl -v ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/user/installations/${installation_id}/repositories/${repository_id} + "${GITHUB_API_BASE_URL}/user/installations/${installation_id}/repositories/${repository_id}" + diff --git a/add-team-to-org-project.sh b/add-team-to-org-project.sh index debcdbe4..83d70213 100755 --- a/add-team-to-org-project.sh +++ b/add-team-to-org-project.sh @@ -10,6 +10,6 @@ json_file=test-data/team-permissions.json curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/projects/${project_id} --data @${json_file} + "${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/projects/${project_id}" --data @${json_file} + diff --git a/add-team-to-repo.sh b/add-team-to-repo.sh index ab790c7f..1d34804c 100755 --- a/add-team-to-repo.sh +++ b/add-team-to-repo.sh @@ -25,3 +25,4 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/teams/${team_id}/repos/${org}/${repo}" --data @${json_file} + diff --git a/add-user-access-restrictions.sh b/add-user-access-restrictions.sh index 4fa09a73..a1ec2e1c 100755 --- a/add-user-access-restrictions.sh +++ b/add-user-access-restrictions.sh @@ -12,7 +12,7 @@ if [ -z "$1" ] username=$1 fi -json_file="tmp/add-user-access-restrictions" +json_file="tmp/add-user-access-restrictions.json" jq -n \ --arg username "${username}" \ @@ -26,9 +26,6 @@ cat $json_file | jq -r branch=${protected_branch_name} - -set -x - curl ${curl_custom_flags} \ -H "X-GitHub-Api-Version: ${github_api_version}" \ -H "Accept: application/vnd.github.v3+json" \ diff --git a/add-user-to-org.sh b/add-user-to-org.sh index 2f05d3c1..22ca8399 100755 --- a/add-user-to-org.sh +++ b/add-user-to-org.sh @@ -3,10 +3,9 @@ # https://docs.github.com/en/enterprise-server@3.10/rest/orgs/members?apiVersion=2022-11-28#set-organization-membership-for-a-user # PUT /orgs/{org}/memberships/{username} -json_file=tmp/set-organization-membership-for-a-user.json - role="member" +json_file=tmp/set-organization-membership-for-a-user.json jq -n \ --arg role "${role}" \ '{ diff --git a/add-user-to-team.sh b/add-user-to-team.sh index a05fe014..f9eab805 100755 --- a/add-user-to-team.sh +++ b/add-user-to-team.sh @@ -8,7 +8,7 @@ # If the script is passed an argument $1 use that as the team name if [ -z "$1" ] then - team_slug=$team_slug + team_slug=${team_slug} else team_slug=$1 fi @@ -16,7 +16,7 @@ fi # If the script is passed an argument $1 use that as the user name if [ -z "$2" ] then - team_member=$default_committer + team_member=${default_committer} else team_member=$2 fi @@ -28,3 +28,4 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_member}" + diff --git a/add-users-to-org.sh b/add-users-to-org.sh index 9752755f..5b81bada 100755 --- a/add-users-to-org.sh +++ b/add-users-to-org.sh @@ -11,5 +11,5 @@ do -X PUT \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${person} + "${GITHUB_API_BASE_URL}/orgs/${org}/memberships/${person}" done diff --git a/add-users-to-team.sh b/add-users-to-team.sh index 029982a4..4be30d71 100755 --- a/add-users-to-team.sh +++ b/add-users-to-team.sh @@ -10,5 +10,6 @@ do echo "======================== ${team_member} ==========================" >&2 curl --silent ${curl_custom_flags} \ -X PUT \ - -H "Authorization: Bearer ${GITHUB_TOKEN}" ${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_member} + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/teams/${team_id}/memberships/${team_member}" done diff --git a/get-a-pull-request.sh b/get-a-pull-request.sh new file mode 100755 index 00000000..1aec3408 --- /dev/null +++ b/get-a-pull-request.sh @@ -0,0 +1,20 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/pulls?apiVersion=2022-11-28 +# GET /repos/{owner}/{repo}/pulls/{pull_number} + + +if [ -z "$1" ] + then + pull_number=${default_pull_request_id} + else + pull_number=$1 +fi + + +curl ${curl_custom_flags} \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Accept: application/vnd.github.shadow-cat-preview+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}" + diff --git a/get-all-repository-topics.sh b/get-all-repository-topics.sh new file mode 100755 index 00000000..68264b17 --- /dev/null +++ b/get-all-repository-topics.sh @@ -0,0 +1,11 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/rest/reference/repos#get-all-repository-topics +# GET /repos/{owner}/{repo}/topics + + +curl ${curl_custom_flags} \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/topics" + diff --git a/list-app-installations-accessible-to-the-user-access-token.sh b/list-app-installations-accessible-to-the-user-access-token.sh new file mode 100755 index 00000000..b24c6d9a --- /dev/null +++ b/list-app-installations-accessible-to-the-user-access-token.sh @@ -0,0 +1,11 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token +# GET /user/installations + + +curl ${curl_custom_flags} \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/user/installations" + diff --git a/list-codes-of-conduct.sh b/list-codes-of-conduct.sh index 96d0ddca..ce2b2d4a 100755 --- a/list-codes-of-conduct.sh +++ b/list-codes-of-conduct.sh @@ -1,10 +1,11 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/codes-of-conduct#get-all-codes-of-conduct +# https://docs.github.com/en/enterprise-cloud@latest/rest/codes-of-conduct/codes-of-conduct?apiVersion=2022-11-28#get-all-codes-of-conduct # GET /codes_of_conduct + curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.scarlet-witch-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/codes_of_conduct" + diff --git a/list-organization-projects.sh b/list-organization-projects.sh index f30c4c15..b30c233b 100755 --- a/list-organization-projects.sh +++ b/list-organization-projects.sh @@ -1,10 +1,11 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/projects#list-organization-projects -# GET /orgs/:org/projects +# https://docs.github.com/en/enterprise-cloud@latest/rest/projects/projects?apiVersion=2022-11-28#list-organization-projects +# GET /orgs/{org}/projects + curl ${curl_custom_flags} \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ - -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - "${GITHUB_API_BASE_URL}/orgs/${org}/projects" + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/orgs/${org}/projects" + diff --git a/list-project-columns.sh b/list-project-columns.sh index 151fbfa8..9eaa919e 100755 --- a/list-project-columns.sh +++ b/list-project-columns.sh @@ -1,13 +1,13 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/projects#list-project-columns -# GET /projects/:project_id/columns +# https://docs.github.com/en/enterprise-cloud@latest/rest/projects/columns?apiVersion=2022-11-28#list-project-columns +# GET /projects/{project_id}/columns + project_id=$(./list-projects.sh preview | jq '.[] | .id') curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/projects/${project_id}/columns" diff --git a/list-projects.sh b/list-projects.sh index c3295ac8..f760905a 100755 --- a/list-projects.sh +++ b/list-projects.sh @@ -11,7 +11,6 @@ if [ ${wanted} == "preview" ]; then >&2 echo header in place this will succeed. curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/orgs/${org}/projects" else diff --git a/list-pull-request.sh b/list-pull-request.sh index 210b4c58..78972ca2 100755 --- a/list-pull-request.sh +++ b/list-pull-request.sh @@ -1,7 +1,10 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/pulls#get-a-pull-request -# GET /repos/:owner/:repo/pulls/:pull_number +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/pulls?apiVersion=2022-11-28 +# + +# DEPRECATE +# this change in the docs to get-a-pull-request so get-a-pull-request.sh was created if [ -z "$1" ] then @@ -11,9 +14,8 @@ if [ -z "$1" ] fi - curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.shadow-cat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}" + diff --git a/list-pull-requests-associated-with-a-commit.sh b/list-pull-requests-associated-with-a-commit.sh index 057a1e56..26940d51 100755 --- a/list-pull-requests-associated-with-a-commit.sh +++ b/list-pull-requests-associated-with-a-commit.sh @@ -3,11 +3,11 @@ # https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit # GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls + commit_sha=$1 curl -v ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.groot-preview+json" \ - -H "Accept: application/vnd.github.shadow-cat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/commits/${commit_sha}/pulls" + diff --git a/list-release-assets.sh b/list-release-assets.sh index 6c5f23ae..a35428a5 100755 --- a/list-release-assets.sh +++ b/list-release-assets.sh @@ -1,12 +1,13 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/enterprise-server/rest/reference/repos#list-release-assets -# GET /repos/:owner/:repo/releases/:release_id/assets +# https://docs.github.com/en/enterprise-cloud@latest/rest/releases/assets?apiVersion=2022-11-28#list-release-assets +# GET /repos/{owner}/{repo}/releases/{release_id}/assets + release_id=${1:-1} curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/releases/${release_id}/assets + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/releases/${release_id}/assets" + diff --git a/list-repo-topics.sh b/list-repo-topics.sh index 8415e6d0..68264b17 100755 --- a/list-repo-topics.sh +++ b/list-repo-topics.sh @@ -6,6 +6,6 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.mercy-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/topics + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/topics" + diff --git a/list-repositories-accessible-to-the-user-access-token.sh b/list-repositories-accessible-to-the-user-access-token.sh index 9b8c989e..77cdbd80 100755 --- a/list-repositories-accessible-to-the-user-access-token.sh +++ b/list-repositories-accessible-to-the-user-access-token.sh @@ -3,11 +3,11 @@ # https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-user-access-token # GET /user/installations/{installation_id}/repositories + installation_id=${default_installation_id} curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/user/installations/${installation_id}/repositories" diff --git a/list-repository-projects.sh b/list-repository-projects.sh index dd8867b8..2701f284 100755 --- a/list-repository-projects.sh +++ b/list-repository-projects.sh @@ -1,10 +1,10 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/projects#list-repository-projects +# https://docs.github.com/en/enterprise-cloud@latest/rest/projects/projects?apiVersion=2022-11-28#list-repository-projects # GET /repos/{owner}/{repo}/projects + curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/projects + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/projects" diff --git a/list-reviews-for-a-pull-request.sh b/list-reviews-for-a-pull-request.sh new file mode 100755 index 00000000..b4936a52 --- /dev/null +++ b/list-reviews-for-a-pull-request.sh @@ -0,0 +1,12 @@ +. ./.gh-api-examples.conf + +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/reviews?apiVersion=2022-11-28#list-reviews-for-a-pull-request +# GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews + +pull_number=${default_pull_request_id} + +curl ${curl_custom_flags} \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}/reviews" + diff --git a/list-reviews-for-pull-request.sh b/list-reviews-for-pull-request.sh index 8f4cfbe9..b4936a52 100755 --- a/list-reviews-for-pull-request.sh +++ b/list-reviews-for-pull-request.sh @@ -1,13 +1,12 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/pulls#list-reviews-for-a-pull-request +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/reviews?apiVersion=2022-11-28#list-reviews-for-a-pull-request # GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews pull_number=${default_pull_request_id} -set -x curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.shadow-cat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}/reviews + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}/reviews" + diff --git a/list-user-installations.sh b/list-user-installations.sh index afb5f81c..b24c6d9a 100755 --- a/list-user-installations.sh +++ b/list-user-installations.sh @@ -1,11 +1,11 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#list-app-installations-accessible-to-the-user-access-token +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token # GET /user/installations curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/user/installations + "${GITHUB_API_BASE_URL}/user/installations" + diff --git a/org-members-can-create-repositories.sh b/org-members-can-create-repositories.sh index 1aaced35..e2bda38d 100755 --- a/org-members-can-create-repositories.sh +++ b/org-members-can-create-repositories.sh @@ -1,21 +1,22 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/orgs#update-an-organization -# PATCH /orgs/:org +# https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#update-an-organization +# PATCH /orgs/{org} + members_can_create_repositories=${1:-true} + json_file=tmp/members-can.json -rm -f ${json_file} jq -n \ - --arg mccr "${members_can_create_repositories}" \ - '{ "members_can_create_repositories" : $mccr | test("true") }' > ${json_file} + --arg members_can_create_repositories "${members_can_create_repositories}" \ + '{ "members_can_create_repositories" : $members_can_create_repositories | test("true") }' > ${json_file} curl ${curl_custom_flags} \ -X PATCH \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.surtur-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org} --data @${json_file} + "${GITHUB_API_BASE_URL}/orgs/${org}" --data @${json_file} + diff --git a/remove-repository-from-an-app-installation.sh b/remove-repository-from-an-app-installation.sh index 016b7520..42682e3e 100755 --- a/remove-repository-from-an-app-installation.sh +++ b/remove-repository-from-an-app-installation.sh @@ -1,6 +1,6 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#remove-a-repository-from-an-app-installation +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/installations?apiVersion=2022-11-28#remove-a-repository-from-an-app-installation # DELETE /user/installations/{installation_id}/repositories/{repository_id} repository_name=${1:-testrepo} @@ -10,6 +10,6 @@ installation_id=${2:-1} curl ${curl_custom_flags} \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/user/installations/${installation_id}/repositories/${repository_id} + "${GITHUB_API_BASE_URL}/user/installations/${installation_id}/repositories/${repository_id}" + diff --git a/replace-repo-topics.sh b/replace-repo-topics.sh index 7fe390de..8a7d4f16 100755 --- a/replace-repo-topics.sh +++ b/replace-repo-topics.sh @@ -1,23 +1,19 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/repos#replace-all-repository-topics +# https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos?apiVersion=2022-11-28#replace-all-repository-topics # PUT /repos/{owner}/{repo}/topics -json_file=tmp/replace_topics.json names="topic-a" -rm -f ${json_file} - +json_file=tmp/replace_topics.json jq -n \ --arg names "${names}" \ '{ names: [ $names ] }' > ${json_file} -cat ${json_file} | jq -r -set -x curl -X PUT ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.mercy-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/topics --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/topics" --data @${json_file} + diff --git a/search-api-commits.sh b/search-api-commits.sh index e88aa9e9..1420bbc6 100755 --- a/search-api-commits.sh +++ b/search-api-commits.sh @@ -13,9 +13,7 @@ search_query="repo:${org}/${repo}+${search_string}" echo "This doesn't seem to return anything in the example docs e.g. no resuls for css in the spoon knife repo." -set -x curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.cloak-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/search/commits?q=${search_query}" diff --git a/set-branch-protection.sh b/set-branch-protection.sh index 3d12768b..f5b4916f 100755 --- a/set-branch-protection.sh +++ b/set-branch-protection.sh @@ -1,22 +1,20 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection +# https://docs.github.com/en/enterprise-cloud@latest/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection # PUT /repos/{owner}/{repo}/branches/{branch}/protection # If the script is passed an argument $1 use that as the name of the repo if [ -z "$1" ] then - repo=$repo + repo=${repo} else repo=$1 fi -json_file=tmp/branch-protection.json source_json=test-data/api-doc-set-branch-protection.json -#cat ${source_json} | jq -r >&2 - +json_file=tmp/branch-protection.json cat ${source_json}| jq --arg team_slug "$team_slug" \ --arg team_admin "$team_admin" \ --argjson enforce_admins $enforce_admins \ @@ -32,7 +30,6 @@ cat ${source_json}| jq --arg team_slug "$team_slug" \ curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.luke-cage-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/branches/${protected_branch_name}/protection --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/branches/${protected_branch_name}/protection" --data @${json_file} diff --git a/tiny-call-get-installation-token.sh b/tiny-call-get-installation-token.sh index 09ff30cc..ba732650 100755 --- a/tiny-call-get-installation-token.sh +++ b/tiny-call-get-installation-token.sh @@ -1,19 +1,17 @@ . ./.gh-api-examples.conf -# https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation# -# https://api.github.com/app/installations/:installation_id/access_tokens - -# limits: https://docs.github.com/en/developers/apps/building-github-apps/rate-limits-for-github-apps +# https://docs.github.com/en/enterprise-cloud@latest/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation # -JWT=$(./tiny-call-get-jwt.sh ${default_app_id} 2>/dev/null) +# rate_limits: https://docs.github.com/en/developers/apps/building-github-apps/rate-limits-for-github-apps -installation_id=${default_installation_id} +JWT=$(./tiny-call-get-jwt.sh ${default_app_id} 2>/dev/null) +installation_id=${default_installation_id} curl --silent ${curl_custom_flags} \ -X POST \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/installations/${installation_id}/access_tokens + "${GITHUB_API_BASE_URL}/app/installations/${installation_id}/access_tokens" + diff --git a/tiny-create-check-run-with-annotation.sh b/tiny-create-check-run-with-annotation.sh index fef5743b..f617dd18 100755 --- a/tiny-create-check-run-with-annotation.sh +++ b/tiny-create-check-run-with-annotation.sh @@ -3,6 +3,7 @@ # https://docs.github.com/en/rest/reference/checks#create-a-check-run # POST /repos/{owner}/{repo}/check-runs + branch_for_check=${branch_name} if [ -z "$1" ] @@ -12,27 +13,23 @@ if [ -z "$1" ] head_sha=$1 fi -# Only GitHub Apps may use the checks api so -GITHUB_APP_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') - -json_file=tmp/create-check-run.json - check_run_name="the-power-check-run-with-annotation" - check_run_status="queued" # status Can be one of: queued, in_progress, completed +json_file=tmp/create-check-run.json jq -n \ --arg name "${check_run_name}" \ --arg head_sha "${head_sha}" \ --arg status "${check_run_status}" \ '{ head_sha: $head_sha, status: $status, name: $name, "output":{"title":"Mighty Readme report","summary":"testing a failure","text":"This should annotate the first line of a commit ","annotations":[{"path":".gitattributes","annotation_level":"failure","title":"Spell Checker","message":"Check your spelling for 'banaas'.","raw_details":"Do you mean 'bananas' or 'banana'?","start_line":1,"end_line":1}]}}' > ${json_file} +# Only GitHub Apps may use the checks api so +GITHUB_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') curl ${curl_custom_flags} \ -X POST \ - -H "Authorization: Bearer ${GITHUB_APP_TOKEN}" \ + -H "Authorization: Bearer ${GITHUB_TOKEN_TOKEN}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.antiope-preview+json" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs \ - --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs" --data @${json_file} + diff --git a/tiny-create-check-run-with-conclusion-success.sh b/tiny-create-check-run-with-conclusion-success.sh index 7ec959c6..b580a252 100755 --- a/tiny-create-check-run-with-conclusion-success.sh +++ b/tiny-create-check-run-with-conclusion-success.sh @@ -1,6 +1,6 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/checks#create-a-check-run +# https://docs.github.com/en/enterprise-cloud@latest/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run # POST /repos/{owner}/{repo}/check-runs branch_for_check=${branch_name} @@ -23,8 +23,6 @@ check_run_conclusion="success" check_run_status="completed" -GITHUB_APP_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') - json_file=tmp/create-check-run.json jq -n \ @@ -35,9 +33,11 @@ jq -n \ '{ head_sha: $head_sha, status: $status, name: $name, conclusion: $conclusion }' > ${json_file} +GITHUB_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') + curl ${curl_custom_flags} \ -X POST \ - -H "Authorization: Bearer ${GITHUB_APP_TOKEN}" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.antiope-preview+json" \ "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs" --data @${json_file} + diff --git a/tiny-create-check-run-with-conclusion.sh b/tiny-create-check-run-with-conclusion.sh index 1b26dbe9..631cd04a 100755 --- a/tiny-create-check-run-with-conclusion.sh +++ b/tiny-create-check-run-with-conclusion.sh @@ -23,10 +23,7 @@ check_run_conclusion="action_required" check_run_status="queued" -GITHUB_APP_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') - json_file=tmp/create-check-run.json - jq -n \ --arg name "${check_run_name}" \ --arg head_sha "${head_sha}" \ @@ -34,10 +31,11 @@ jq -n \ --arg conclusion "${check_run_conclusion}" \ '{ head_sha: $head_sha, status: $status, name: $name, conclusion: $conclusion }' > ${json_file} +GITHUB_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') + curl ${curl_custom_flags} \ -X POST \ - -H "Authorization: Bearer ${GITHUB_APP_TOKEN}" \ + -H "Authorization: Bearer ${GITHUB_TOKEN_TOKEN}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.antiope-preview+json" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs \ - --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs" --data @${json_file} + diff --git a/tiny-get-an-app.sh b/tiny-get-an-app.sh index 3d2ce411..4aab67ca 100755 --- a/tiny-get-an-app.sh +++ b/tiny-get-an-app.sh @@ -19,9 +19,7 @@ fi GITHUB_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') -set -x curl ${curl_custom_flags} \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ "${GITHUB_API_BASE_URL}/apps/${app_slug}" diff --git a/tiny-get-webhook-configuration-for-an-app.sh b/tiny-get-webhook-configuration-for-an-app.sh index 63d38ad7..d6e132ae 100755 --- a/tiny-get-webhook-configuration-for-an-app.sh +++ b/tiny-get-webhook-configuration-for-an-app.sh @@ -1,6 +1,6 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#get-a-webhook-configuration-for-an-app +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-app # GET /app/hook/config # This endpoint has to be presented with a jwt @@ -8,5 +8,5 @@ JWT=$(./tiny-call-get-jwt.sh) curl ${curl_custom_flags} \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/hook/config + "${GITHUB_API_BASE_URL}/app/hook/config" + diff --git a/tiny-list-app-installations.sh b/tiny-list-app-installations.sh index 6488324d..a68b5324 100755 --- a/tiny-list-app-installations.sh +++ b/tiny-list-app-installations.sh @@ -1,10 +1,10 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#list-installations-for-the-authenticated-app +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#list-installations-for-the-authenticated-app # GET /app/installations -# This endpoint has to be presented with a jwt +# This endpoint has to be presented with a jwt # If the script is passed an argument $1 use that as the JWT if [ -z "$1" ] then @@ -15,6 +15,5 @@ fi curl ${curl_custom_flags} \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/installations + "${GITHUB_API_BASE_URL}/app/installations" diff --git a/tiny-suspend-app-installation.sh b/tiny-suspend-app-installation.sh index 56dfd049..707383cc 100755 --- a/tiny-suspend-app-installation.sh +++ b/tiny-suspend-app-installation.sh @@ -1,13 +1,14 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#suspend-an-app-installation +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#suspend-an-app-installation # PUT /app/installations/{installation_id}/suspended + # This endpoint has to be presented with a jwt JWT=$(./tiny-call-get-jwt.sh) curl ${curl_custom_flags} \ -X PUT \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/installations/${default_installation_id}/suspended + "${GITHUB_API_BASE_URL}/app/installations/${default_installation_id}/suspended" + diff --git a/tiny-unsuspend-app-installation.sh b/tiny-unsuspend-app-installation.sh index 583dfdef..aa5bc755 100755 --- a/tiny-unsuspend-app-installation.sh +++ b/tiny-unsuspend-app-installation.sh @@ -1,6 +1,6 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/apps#unsuspend-an-app-installation +# https://docs.github.com/en/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#unsuspend-an-app-installation # DELETE /app/installations/{installation_id}/suspended # This endpoint has to be presented with a jwt @@ -9,5 +9,5 @@ JWT=$(./tiny-call-get-jwt.sh) curl ${curl_custom_flags} \ -X DELETE \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/installations/${default_installation_id}/suspended + "${GITHUB_API_BASE_URL}/app/installations/${default_installation_id}/suspended" + diff --git a/tiny-update-a-check-run.sh b/tiny-update-a-check-run.sh index 0a7098b6..2c6a41de 100755 --- a/tiny-update-a-check-run.sh +++ b/tiny-update-a-check-run.sh @@ -48,6 +48,5 @@ curl ${curl_custom_flags} \ -X PATCH \ -H "Authorization: Bearer ${GITHUB_APP_TOKEN}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.antiope-preview+json" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs/${check_run_id} \ - --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/check-runs/${check_run_id}" --data @${json_file} + diff --git a/update-a-pull-request-branch.sh b/update-a-pull-request-branch.sh index 26da8b94..38bd23c2 100755 --- a/update-a-pull-request-branch.sh +++ b/update-a-pull-request-branch.sh @@ -1,14 +1,13 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/pulls#update-a-pull-request-branch +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request-branch # PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch - json_file="update-a-pull-request-branch.json" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.lydian-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number} --data @${json} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}" --data @${json} + diff --git a/update-badteam-repository.sh b/update-badteam-repository.sh index ff7a113e..2f1a7bc2 100755 --- a/update-badteam-repository.sh +++ b/update-badteam-repository.sh @@ -8,6 +8,5 @@ team_slug="bad-team" curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Content-Type: application/vnd.github.hellcat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo} --data '{"permission": "push" }' + "${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${org}/${repo}" --data '{"permission": "push" }' diff --git a/update-branch-protection-with-required-check.sh b/update-branch-protection-with-required-check.sh index 6c144a36..41e355f4 100755 --- a/update-branch-protection-with-required-check.sh +++ b/update-branch-protection-with-required-check.sh @@ -1,7 +1,7 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/repos#update-branch-protection -# PUT /repos/:owner/:repo/branches/:branch/protection +# https://docs.github.com/en/enterprise-cloud@latest/rest/branches/branch-protection?apiVersion=2022-11-28 +# GET /repos/{owner}/{repo}/branches/{branch}/protection # If the script is passed an argument $1 use that as the name of the repo if [ -z "$1" ] @@ -12,6 +12,7 @@ if [ -z "$1" ] fi json_file=tmp/branch-protection.json + source_json=test-data/api-doc-set-branch-protection.json cat ${source_json}| jq --arg team_slug "$team_slug" \ @@ -31,7 +32,6 @@ cat ${source_json}| jq --arg team_slug "$team_slug" \ curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.luke-cage-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/branches/${protected_branch_name}/protection" --data @${json_file} diff --git a/update-team-repository.sh b/update-team-repository.sh index 2c84b62c..7f8c7b83 100755 --- a/update-team-repository.sh +++ b/update-team-repository.sh @@ -1,13 +1,13 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions -# PUT /orgs/:org/teams/:team_slug/repos/:owner/:repo +# https://docs.github.com/en/enterprise-cloud@latest/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions +# PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} owner=${default_owner} curl ${curl_custom_flags} \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ - -H "Content-Type: application/vnd.github.hellcat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${owner}/${repo} --data '{"permission": "triage" }' + "${GITHUB_API_BASE_URL}/orgs/${org}/teams/${team_slug}/repos/${owner}/${repo}" --data '{"permission": "triage" }' + From e3300f8590961b4d3ee2fe19b9e70c36691f772d Mon Sep 17 00:00:00 2001 From: David Morris Date: Thu, 30 Jan 2025 21:16:21 +0000 Subject: [PATCH 2/2] closing #263 --- ...nerability-alerts-are-enabled-for-repository.sh | 1 - create-a-pre-receive-hook.sh | 7 ++++--- create-a-repository-for-the-authenticated-user.sh | 1 - create-draft-pull-request.sh | 14 +++++++------- create-n-repos.sh | 1 - create-organization-project-columns.sh | 1 - create-organization-project.sh | 1 - create-pages.sh | 1 - create-project-card.sh | 1 - create-project-repo-project.sh | 1 - create-repo.sh | 1 - disable-pages.sh | 1 - get-a-pull-request.sh | 1 - get-an-app.sh | 4 +--- get-code-of-conduct.sh | 4 ++-- get-commit-signature-protection.sh | 1 - get-project-permission-for-user.sh | 1 - graphql-count-pull-request-comments.sh | 1 - graphql-count-team-members.sh | 1 - graphql-create-enterprise-ip-allow-list-entry.sh | 1 - graphql-create-ip-allow-list-entry.sh | 1 - graphql-create-issue.sh | 1 - graphql-create-repo-discussion.sh | 1 - graphql-delete-discussion.sh | 1 - graphql-delete-ip-allow-list-entry.sh | 1 - graphql-dependencyGraphManifests.sh | 1 - graphql-dequeue-pull-request.sh | 1 - graphql-discussion-categories.sh | 1 - graphql-enable-pull-request-auto-merge.sh | 1 - graphql-enqueue-pull-request.sh | 1 - graphql-enterprise-sso-member-details.sh | 1 - graphql-file-bytesize.sh | 1 - graphql-get-a-security-advisory.sh | 1 - graphql-get-enterprise-audit-log.sh | 1 - graphql-get-issues.sh | 1 - graphql-get-pull-request-id.sh | 1 - graphql-get-rate-limit.sh | 1 - graphql-get-repo-deploy-keys.sh | 1 - graphql-get-repo-size.sh | 1 - graphql-harness.sh | 1 - graphql-list-audit-audit-log-invite-members.sh | 1 - graphql-list-available-licenses.sh | 1 - graphql-list-branch-commit-dates.sh | 1 - graphql-list-branches-in-repository.sh | 1 - graphql-list-collaborators-on-file.sh | 1 - graphql-list-domain-verified-email-addresses.sh | 1 - graphql-list-enterprise-id.sh | 1 - graphql-list-enterprise-members.sh | 1 - graphql-list-immediate-team-members.sh | 1 - graphql-list-ip-allow-list-entries.sh | 1 - graphql-list-issue.sh | 1 - graphql-list-locked-repositories.sh | 1 - graphql-list-org-members-saml.sh | 1 - graphql-list-org-sso.sh | 1 - graphql-list-organization-members.sh | 1 - graphql-list-organization-packages.sh | 1 - graphql-list-organization-repositories.sh | 1 - graphql-list-organization-topics.sh | 1 - graphql-list-organization.sh | 3 +-- graphql-list-pull-request-mergequeue-entry.sh | 1 - ...ist-pull-request-requiredStatusCheckContexts.sh | 1 - graphql-list-pull-request-timeline-items.sh | 1 - graphql-list-repo-mergequeue.sh | 1 - graphql-list-repo-pull-requests.sh | 1 - graphql-list-repo-vulnerability-alerts.sh | 7 ++----- ...hql-list-repository-dependencyGraphManifests.sh | 1 - graphql-list-repository-discussions.sh | 3 +-- graphql-list-repository.sh | 3 +-- graphql-list-user-id.sh | 3 +-- graphql-list-user-team-memberships.sh | 3 +-- graphql-merge-pull-request.sh | 2 +- graphql-pull-request-closingissuereferences.sh | 1 - graphql-remove-enteprise-member.sh | 1 - graphql-show-locked-repos.sh | 1 - graphql-update-branch-protection-rule.sh | 1 - ...eMembersCanChangeRepositoryVisibilitySetting.sh | 4 ++-- graphql-updateenterpriseadministratorrole.sh | 1 - 77 files changed, 24 insertions(+), 98 deletions(-) diff --git a/check-if-vulnerability-alerts-are-enabled-for-repository.sh b/check-if-vulnerability-alerts-are-enabled-for-repository.sh index 08a9d511..7c6acd27 100755 --- a/check-if-vulnerability-alerts-are-enabled-for-repository.sh +++ b/check-if-vulnerability-alerts-are-enabled-for-repository.sh @@ -5,6 +5,5 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.dorian-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/vulnerability-alerts diff --git a/create-a-pre-receive-hook.sh b/create-a-pre-receive-hook.sh index c3c5b1d1..880917b5 100755 --- a/create-a-pre-receive-hook.sh +++ b/create-a-pre-receive-hook.sh @@ -1,8 +1,9 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/enterprise-server@3.1/rest/reference/enterprise-admin#create-a-pre-receive-hook +# https://docs.github.com/en/enterprise-server/rest/enterprise-admin/pre-receive-hooks?apiVersion=2022-11-28#create-a-pre-receive-hook # POST /admin/pre-receive-hooks + json_file=tmp/pre-receive-hook-details.json jq -n \ @@ -22,8 +23,8 @@ jq -n \ allow_downstream_configuration: $allow_downstream_configuration | test("true") }' > ${json_file} + curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.eye-scream-preview" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/admin/pre-receive-hooks --data @${json_file} + "${GITHUB_API_BASE_URL}/admin/pre-receive-hooks" --data @${json_file} diff --git a/create-a-repository-for-the-authenticated-user.sh b/create-a-repository-for-the-authenticated-user.sh index 8732532c..58291420 100755 --- a/create-a-repository-for-the-authenticated-user.sh +++ b/create-a-repository-for-the-authenticated-user.sh @@ -37,7 +37,6 @@ jq -n \ set -x curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.nebula-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/user/repos --data @${json_file} diff --git a/create-draft-pull-request.sh b/create-draft-pull-request.sh index 7ea16c68..59dde66f 100755 --- a/create-draft-pull-request.sh +++ b/create-draft-pull-request.sh @@ -1,18 +1,18 @@ . ./.gh-api-examples.conf -# https://docs.github.com/en/rest/reference/pulls#create-a-pull-request -# POST /repos/:owner/:repo/pulls +# https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request +# POST /repos/{owner}/{repo}/pulls -json_file="create-pull-request.json" -rm -f ${json_file} timestamp=$(date +%s) title="Amazing new feature PR: $timestamp" -lorem_file="lorem-pull-request.md" +lorem_file="test-data/lorem-pull-request.md" lorem_text=$(cat $lorem_file) +json_file="create-pull-request.json" + jq -n \ --arg title "$title (started as draft PR)" \ --arg body "${lorem_text}" \ @@ -30,6 +30,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.shadow-cat-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls --data @${json_file} + "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls" --data @${json_file} + diff --git a/create-n-repos.sh b/create-n-repos.sh index 0ab7c4bb..6040ce32 100755 --- a/create-n-repos.sh +++ b/create-n-repos.sh @@ -51,7 +51,6 @@ do curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.nebula-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/orgs/${org}/repos --data @${json_file} | jq -r '"\(.id),\(.full_name)"' done diff --git a/create-organization-project-columns.sh b/create-organization-project-columns.sh index 731924ab..05c78872 100755 --- a/create-organization-project-columns.sh +++ b/create-organization-project-columns.sh @@ -31,7 +31,6 @@ do curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/projects/${project_id}/columns --data @${json_file} cat ${json_file} diff --git a/create-organization-project.sh b/create-organization-project.sh index 522d0793..0b8cb0b0 100755 --- a/create-organization-project.sh +++ b/create-organization-project.sh @@ -14,7 +14,6 @@ echo ${DATA} > ${json_file} curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/orgs/${org}/projects --data @${json_file} diff --git a/create-pages.sh b/create-pages.sh index f74fd041..88be5492 100755 --- a/create-pages.sh +++ b/create-pages.sh @@ -17,7 +17,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.switcheroo-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pages --data @${json_file} diff --git a/create-project-card.sh b/create-project-card.sh index d18f4241..4558f8ed 100755 --- a/create-project-card.sh +++ b/create-project-card.sh @@ -10,6 +10,5 @@ json=project-card-note.json curl ${curl_custom_flags} \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/projects/columns/${column_id}/cards --data @${json} diff --git a/create-project-repo-project.sh b/create-project-repo-project.sh index 80bf18aa..2fdc69d2 100755 --- a/create-project-repo-project.sh +++ b/create-project-repo-project.sh @@ -21,7 +21,6 @@ if [ ${wanted} == "preview" ]; then curl ${curl_custom_flags} \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/projects --data @${json_file} else diff --git a/create-repo.sh b/create-repo.sh index dbc9eff6..f903f13c 100755 --- a/create-repo.sh +++ b/create-repo.sh @@ -38,7 +38,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.nebula-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/orgs/${org}/repos --data @${json_file} diff --git a/disable-pages.sh b/disable-pages.sh index fd3614d8..7c19e53a 100755 --- a/disable-pages.sh +++ b/disable-pages.sh @@ -6,6 +6,5 @@ curl ${curl_custom_flags} \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.switcheroo-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pages diff --git a/get-a-pull-request.sh b/get-a-pull-request.sh index 1aec3408..b7fa0a87 100755 --- a/get-a-pull-request.sh +++ b/get-a-pull-request.sh @@ -14,7 +14,6 @@ fi curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.shadow-cat-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_API_BASE_URL}/repos/${org}/${repo}/pulls/${pull_number}" diff --git a/get-an-app.sh b/get-an-app.sh index 7adb3217..3073b07f 100755 --- a/get-an-app.sh +++ b/get-an-app.sh @@ -20,10 +20,8 @@ fi # This version is set up to work on GHES: JWT=$(./tiny-call-get-jwt.sh 2>/dev/null) -set -x curl ${curl_custom_flags} \ -H "Authorization: Bearer ${JWT}" \ - -H "Accept: application/vnd.github.machine-man-preview+json" \ - ${GITHUB_API_BASE_URL}/app/installations + "${GITHUB_API_BASE_URL}/app/installations" diff --git a/get-code-of-conduct.sh b/get-code-of-conduct.sh index 35db15f4..4a5546aa 100755 --- a/get-code-of-conduct.sh +++ b/get-code-of-conduct.sh @@ -7,7 +7,7 @@ name=${1:-contributor_covenant} curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: Accept: application/vnd.github.scarlet-witch-preview+json" \ -H "Accept: application/vnd.github.VERSION.raw" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_API_BASE_URL}/codes_of_conduct/${name} + "${GITHUB_API_BASE_URL}/codes_of_conduct/${name}" + diff --git a/get-commit-signature-protection.sh b/get-commit-signature-protection.sh index 4b586186..0ad6f327 100755 --- a/get-commit-signature-protection.sh +++ b/get-commit-signature-protection.sh @@ -5,6 +5,5 @@ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.zzzax-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/repos/${org}/${repo}/branches/${protected_branch_name}/protection/required_signatures diff --git a/get-project-permission-for-user.sh b/get-project-permission-for-user.sh index ef4340ff..3542afff 100755 --- a/get-project-permission-for-user.sh +++ b/get-project-permission-for-user.sh @@ -16,6 +16,5 @@ project_id=1 curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.inertia-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_API_BASE_URL}/projects/${project_id}/collaborators/${username}/permission diff --git a/graphql-count-pull-request-comments.sh b/graphql-count-pull-request-comments.sh index 1f8ccf93..a342b16e 100755 --- a/graphql-count-pull-request-comments.sh +++ b/graphql-count-pull-request-comments.sh @@ -48,7 +48,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-count-team-members.sh b/graphql-count-team-members.sh index 2b8a1e78..ff2739cb 100755 --- a/graphql-count-team-members.sh +++ b/graphql-count-team-members.sh @@ -24,7 +24,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-create-enterprise-ip-allow-list-entry.sh b/graphql-create-enterprise-ip-allow-list-entry.sh index ff04afc4..94bef1a8 100755 --- a/graphql-create-enterprise-ip-allow-list-entry.sh +++ b/graphql-create-enterprise-ip-allow-list-entry.sh @@ -47,7 +47,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-create-ip-allow-list-entry.sh b/graphql-create-ip-allow-list-entry.sh index c1d4682a..ac991f82 100755 --- a/graphql-create-ip-allow-list-entry.sh +++ b/graphql-create-ip-allow-list-entry.sh @@ -51,7 +51,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-create-issue.sh b/graphql-create-issue.sh index d87799a6..b52c7609 100755 --- a/graphql-create-issue.sh +++ b/graphql-create-issue.sh @@ -34,7 +34,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-create-repo-discussion.sh b/graphql-create-repo-discussion.sh index e9da4247..b25e6fae 100755 --- a/graphql-create-repo-discussion.sh +++ b/graphql-create-repo-discussion.sh @@ -22,7 +22,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-delete-discussion.sh b/graphql-delete-discussion.sh index 2d2f52f3..6ccfb162 100755 --- a/graphql-delete-discussion.sh +++ b/graphql-delete-discussion.sh @@ -33,7 +33,6 @@ GITHUB_TOKEN=$(./tiny-call-get-installation-token.sh | jq -r '.token') curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: token ${GITHUB_TOKEN}" \ "${GITHUB_APIV4_BASE_URL}" -d @${json_file} | jq diff --git a/graphql-delete-ip-allow-list-entry.sh b/graphql-delete-ip-allow-list-entry.sh index f4486fe2..08bad8b1 100755 --- a/graphql-delete-ip-allow-list-entry.sh +++ b/graphql-delete-ip-allow-list-entry.sh @@ -48,7 +48,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-dependencyGraphManifests.sh b/graphql-dependencyGraphManifests.sh index a2100350..ce83a3e8 100755 --- a/graphql-dependencyGraphManifests.sh +++ b/graphql-dependencyGraphManifests.sh @@ -72,7 +72,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H "Accept: application/vnd.github.hawkgirl-preview+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-dequeue-pull-request.sh b/graphql-dequeue-pull-request.sh index 103488c8..0a7a434a 100755 --- a/graphql-dequeue-pull-request.sh +++ b/graphql-dequeue-pull-request.sh @@ -28,7 +28,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-discussion-categories.sh b/graphql-discussion-categories.sh index 6adff425..ca1118b2 100755 --- a/graphql-discussion-categories.sh +++ b/graphql-discussion-categories.sh @@ -23,7 +23,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-enable-pull-request-auto-merge.sh b/graphql-enable-pull-request-auto-merge.sh index 6fad340a..23e77f17 100755 --- a/graphql-enable-pull-request-auto-merge.sh +++ b/graphql-enable-pull-request-auto-merge.sh @@ -35,6 +35,5 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-enqueue-pull-request.sh b/graphql-enqueue-pull-request.sh index 94ec47be..ec55f95d 100755 --- a/graphql-enqueue-pull-request.sh +++ b/graphql-enqueue-pull-request.sh @@ -28,7 +28,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-enterprise-sso-member-details.sh b/graphql-enterprise-sso-member-details.sh index 8f39a0ea..8cdc9ba9 100755 --- a/graphql-enterprise-sso-member-details.sh +++ b/graphql-enterprise-sso-member-details.sh @@ -38,6 +38,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" | jq -r \ No newline at end of file diff --git a/graphql-file-bytesize.sh b/graphql-file-bytesize.sh index c01de6c5..fc7e8b9b 100755 --- a/graphql-file-bytesize.sh +++ b/graphql-file-bytesize.sh @@ -22,7 +22,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-get-a-security-advisory.sh b/graphql-get-a-security-advisory.sh index 79fc6c02..ec8dd537 100755 --- a/graphql-get-a-security-advisory.sh +++ b/graphql-get-a-security-advisory.sh @@ -28,7 +28,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl --silent ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-get-enterprise-audit-log.sh b/graphql-get-enterprise-audit-log.sh index e03e6c75..d246e789 100755 --- a/graphql-get-enterprise-audit-log.sh +++ b/graphql-get-enterprise-audit-log.sh @@ -32,6 +32,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" | jq -r \ No newline at end of file diff --git a/graphql-get-issues.sh b/graphql-get-issues.sh index 6f04e526..da9070b8 100755 --- a/graphql-get-issues.sh +++ b/graphql-get-issues.sh @@ -36,6 +36,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" | jq -r diff --git a/graphql-get-pull-request-id.sh b/graphql-get-pull-request-id.sh index 87208586..16bef199 100755 --- a/graphql-get-pull-request-id.sh +++ b/graphql-get-pull-request-id.sh @@ -27,7 +27,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-get-rate-limit.sh b/graphql-get-rate-limit.sh index 9fe3de04..0f56b7b1 100755 --- a/graphql-get-rate-limit.sh +++ b/graphql-get-rate-limit.sh @@ -22,7 +22,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-get-repo-deploy-keys.sh b/graphql-get-repo-deploy-keys.sh index 4bee6f76..36d7de88 100755 --- a/graphql-get-repo-deploy-keys.sh +++ b/graphql-get-repo-deploy-keys.sh @@ -26,7 +26,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-get-repo-size.sh b/graphql-get-repo-size.sh index 9f28b462..df15e064 100755 --- a/graphql-get-repo-size.sh +++ b/graphql-get-repo-size.sh @@ -14,7 +14,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-harness.sh b/graphql-harness.sh index 12b65758..b8632847 100755 --- a/graphql-harness.sh +++ b/graphql-harness.sh @@ -57,7 +57,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-audit-audit-log-invite-members.sh b/graphql-list-audit-audit-log-invite-members.sh index d3ab90cf..c2d5bf19 100755 --- a/graphql-list-audit-audit-log-invite-members.sh +++ b/graphql-list-audit-audit-log-invite-members.sh @@ -27,7 +27,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl --silent ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-available-licenses.sh b/graphql-list-available-licenses.sh index cf077242..b330e680 100755 --- a/graphql-list-available-licenses.sh +++ b/graphql-list-available-licenses.sh @@ -26,7 +26,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-branch-commit-dates.sh b/graphql-list-branch-commit-dates.sh index aebaf2a1..7e5926a1 100755 --- a/graphql-list-branch-commit-dates.sh +++ b/graphql-list-branch-commit-dates.sh @@ -38,7 +38,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-branches-in-repository.sh b/graphql-list-branches-in-repository.sh index 82be4cc5..5752559d 100755 --- a/graphql-list-branches-in-repository.sh +++ b/graphql-list-branches-in-repository.sh @@ -38,7 +38,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-collaborators-on-file.sh b/graphql-list-collaborators-on-file.sh index 11a82db5..dbaac1e2 100755 --- a/graphql-list-collaborators-on-file.sh +++ b/graphql-list-collaborators-on-file.sh @@ -37,7 +37,6 @@ set -x curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-domain-verified-email-addresses.sh b/graphql-list-domain-verified-email-addresses.sh index e81f7e49..3c543dbe 100755 --- a/graphql-list-domain-verified-email-addresses.sh +++ b/graphql-list-domain-verified-email-addresses.sh @@ -24,7 +24,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-enterprise-id.sh b/graphql-list-enterprise-id.sh index a093b90b..35dd4da0 100755 --- a/graphql-list-enterprise-id.sh +++ b/graphql-list-enterprise-id.sh @@ -26,7 +26,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ -H "X-Github-Next-Global-ID: 1" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-enterprise-members.sh b/graphql-list-enterprise-members.sh index 7975beac..0633df1b 100755 --- a/graphql-list-enterprise-members.sh +++ b/graphql-list-enterprise-members.sh @@ -25,7 +25,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-immediate-team-members.sh b/graphql-list-immediate-team-members.sh index fba7ef2b..101408c1 100755 --- a/graphql-list-immediate-team-members.sh +++ b/graphql-list-immediate-team-members.sh @@ -33,7 +33,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-ip-allow-list-entries.sh b/graphql-list-ip-allow-list-entries.sh index c51e92cf..cc122499 100755 --- a/graphql-list-ip-allow-list-entries.sh +++ b/graphql-list-ip-allow-list-entries.sh @@ -48,7 +48,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-list-issue.sh b/graphql-list-issue.sh index cb5a252e..139a5035 100755 --- a/graphql-list-issue.sh +++ b/graphql-list-issue.sh @@ -38,7 +38,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-locked-repositories.sh b/graphql-list-locked-repositories.sh index 5be00326..6575e33e 100755 --- a/graphql-list-locked-repositories.sh +++ b/graphql-list-locked-repositories.sh @@ -23,7 +23,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-org-members-saml.sh b/graphql-list-org-members-saml.sh index da5abbd2..0567df93 100755 --- a/graphql-list-org-members-saml.sh +++ b/graphql-list-org-members-saml.sh @@ -38,6 +38,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-org-sso.sh b/graphql-list-org-sso.sh index 20240f3e..8cf0e348 100755 --- a/graphql-list-org-sso.sh +++ b/graphql-list-org-sso.sh @@ -23,7 +23,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-organization-members.sh b/graphql-list-organization-members.sh index 90c6e740..01197e36 100755 --- a/graphql-list-organization-members.sh +++ b/graphql-list-organization-members.sh @@ -23,7 +23,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-organization-packages.sh b/graphql-list-organization-packages.sh index 69e54060..a481002d 100755 --- a/graphql-list-organization-packages.sh +++ b/graphql-list-organization-packages.sh @@ -43,7 +43,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-list-organization-repositories.sh b/graphql-list-organization-repositories.sh index d8da15c3..7051f0a0 100755 --- a/graphql-list-organization-repositories.sh +++ b/graphql-list-organization-repositories.sh @@ -37,7 +37,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-list-organization-topics.sh b/graphql-list-organization-topics.sh index f6970bad..df7214b8 100755 --- a/graphql-list-organization-topics.sh +++ b/graphql-list-organization-topics.sh @@ -34,7 +34,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-organization.sh b/graphql-list-organization.sh index f80ff3a0..4d71cd68 100755 --- a/graphql-list-organization.sh +++ b/graphql-list-organization.sh @@ -21,7 +21,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" + "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-pull-request-mergequeue-entry.sh b/graphql-list-pull-request-mergequeue-entry.sh index 53cfdc87..e621af5b 100755 --- a/graphql-list-pull-request-mergequeue-entry.sh +++ b/graphql-list-pull-request-mergequeue-entry.sh @@ -29,7 +29,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-pull-request-requiredStatusCheckContexts.sh b/graphql-list-pull-request-requiredStatusCheckContexts.sh index 8d3e269b..16233759 100755 --- a/graphql-list-pull-request-requiredStatusCheckContexts.sh +++ b/graphql-list-pull-request-requiredStatusCheckContexts.sh @@ -27,6 +27,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-pull-request-timeline-items.sh b/graphql-list-pull-request-timeline-items.sh index e5a0820b..b6902f9c 100755 --- a/graphql-list-pull-request-timeline-items.sh +++ b/graphql-list-pull-request-timeline-items.sh @@ -56,7 +56,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-repo-mergequeue.sh b/graphql-list-repo-mergequeue.sh index 128522fd..0d82e5b4 100755 --- a/graphql-list-repo-mergequeue.sh +++ b/graphql-list-repo-mergequeue.sh @@ -32,7 +32,6 @@ echo $graphql_script curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-repo-pull-requests.sh b/graphql-list-repo-pull-requests.sh index f73d4103..5c00e755 100755 --- a/graphql-list-repo-pull-requests.sh +++ b/graphql-list-repo-pull-requests.sh @@ -28,6 +28,5 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" set -x curl -v ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-repo-vulnerability-alerts.sh b/graphql-list-repo-vulnerability-alerts.sh index 7cecf201..66bab320 100755 --- a/graphql-list-repo-vulnerability-alerts.sh +++ b/graphql-list-repo-vulnerability-alerts.sh @@ -2,6 +2,7 @@ # https://docs.github.com/en/graphql/reference/objects#package + org=${1:-$org} graphql_query=tmp/graphql_query.txt @@ -38,7 +39,6 @@ EOF cat >&2 $graphql_query json_file=tmp/graphql-vulnerabilities-payload.json -rm -f ${json_file} jq -n \ --arg graphql_query "$(cat $graphql_query)" \ @@ -47,9 +47,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq + "${GITHUB_APIV4_BASE_URL}" -d @${json_file} | jq -rm -f ${graphql_query} -rm -f ${json_file} diff --git a/graphql-list-repository-dependencyGraphManifests.sh b/graphql-list-repository-dependencyGraphManifests.sh index fce33f5a..9a4e7cfb 100755 --- a/graphql-list-repository-dependencyGraphManifests.sh +++ b/graphql-list-repository-dependencyGraphManifests.sh @@ -36,7 +36,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-repository-discussions.sh b/graphql-list-repository-discussions.sh index a07cff0f..7abd45f2 100755 --- a/graphql-list-repository-discussions.sh +++ b/graphql-list-repository-discussions.sh @@ -27,7 +27,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" + "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-repository.sh b/graphql-list-repository.sh index 0d6963cf..e6d0f83a 100755 --- a/graphql-list-repository.sh +++ b/graphql-list-repository.sh @@ -45,7 +45,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" + "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-user-id.sh b/graphql-list-user-id.sh index 85c62021..0127cbe9 100755 --- a/graphql-list-user-id.sh +++ b/graphql-list-user-id.sh @@ -20,7 +20,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ -H "X-Github-Next-Global-ID: 1" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" + "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-list-user-team-memberships.sh b/graphql-list-user-team-memberships.sh index 6c415af9..1c4ba144 100755 --- a/graphql-list-user-team-memberships.sh +++ b/graphql-list-user-team-memberships.sh @@ -25,7 +25,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" + "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-merge-pull-request.sh b/graphql-merge-pull-request.sh index 24c3cdc5..a2cc62b5 100755 --- a/graphql-merge-pull-request.sh +++ b/graphql-merge-pull-request.sh @@ -2,6 +2,7 @@ # https://docs.github.com/en/graphql/reference/mutations#mergepullrequest + pull_request_id=$1 email_address=test@example.com commit_headline="this is the commit_headline" @@ -32,7 +33,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-pull-request-closingissuereferences.sh b/graphql-pull-request-closingissuereferences.sh index a761f82a..9b388e38 100755 --- a/graphql-pull-request-closingissuereferences.sh +++ b/graphql-pull-request-closingissuereferences.sh @@ -45,7 +45,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-remove-enteprise-member.sh b/graphql-remove-enteprise-member.sh index 95e94d38..38809e26 100755 --- a/graphql-remove-enteprise-member.sh +++ b/graphql-remove-enteprise-member.sh @@ -36,7 +36,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq diff --git a/graphql-show-locked-repos.sh b/graphql-show-locked-repos.sh index bd61aee8..7835720d 100755 --- a/graphql-show-locked-repos.sh +++ b/graphql-show-locked-repos.sh @@ -25,7 +25,6 @@ graphql_script="$(echo ${graphql_script//\"/\\\"})" curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ "${GITHUB_APIV4_BASE_URL}" -d "{ \"query\": \"$graphql_script\"}" diff --git a/graphql-update-branch-protection-rule.sh b/graphql-update-branch-protection-rule.sh index 8fef5833..ca44fc3a 100755 --- a/graphql-update-branch-protection-rule.sh +++ b/graphql-update-branch-protection-rule.sh @@ -52,7 +52,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} diff --git a/graphql-updateEnterpriseMembersCanChangeRepositoryVisibilitySetting.sh b/graphql-updateEnterpriseMembersCanChangeRepositoryVisibilitySetting.sh index 28959c7e..733c411c 100755 --- a/graphql-updateEnterpriseMembersCanChangeRepositoryVisibilitySetting.sh +++ b/graphql-updateEnterpriseMembersCanChangeRepositoryVisibilitySetting.sh @@ -2,6 +2,7 @@ # https://docs.github.com/en/graphql/reference/mutations#updateenterprisememberscanchangerepositoryvisibilitysetting + graphql_query=tmp/graphql_query.txt enterpriseId=$(./graphql-list-enterprise-id.sh | jq -r '.data.enterprise.id') @@ -25,7 +26,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq + "${GITHUB_APIV4_BASE_URL}" -d @${json_file} | jq diff --git a/graphql-updateenterpriseadministratorrole.sh b/graphql-updateenterpriseadministratorrole.sh index 9a80d572..5846bfbe 100755 --- a/graphql-updateenterpriseadministratorrole.sh +++ b/graphql-updateenterpriseadministratorrole.sh @@ -50,7 +50,6 @@ jq -n \ curl ${curl_custom_flags} \ -H "Accept: application/vnd.github.v3+json" \ - -H 'Accept: application/vnd.github.audit-log-preview+json' \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ ${GITHUB_APIV4_BASE_URL} -d @${json_file} | jq