From 8048ae4e145f505b19deb00df2507e00b9d142dc Mon Sep 17 00:00:00 2001 From: Alejandro Menocal Date: Fri, 29 Mar 2024 10:31:31 -0500 Subject: [PATCH] remove leading slash and escaping slash --- gh-repo-stats | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gh-repo-stats b/gh-repo-stats index 72bfd18..b41a731 100755 --- a/gh-repo-stats +++ b/gh-repo-stats @@ -222,7 +222,7 @@ Header() { # Validate we can hit the endpoint by getting the current user # ################################################################ if [[ ${GITHUB_TOKEN_TYPE} == "user" ]]; then - USER_DATA=$(gh api "/user") + USER_DATA=$(gh api user) ERROR_CODE=$? ####################### @@ -249,7 +249,7 @@ Header() { # Check GHE version # ##################### if [[ "$(isCloud)" -eq 0 ]]; then - META_DATA=$(gh api "/meta") + META_DATA=$(gh api meta) ERROR_CODE=$? ####################### @@ -471,7 +471,7 @@ CheckAdminRights() { ################## # Get membership # ################## - MEMBERSHIP_DATA=$(gh api "/orgs/${ORG_NAME}/memberships/${USER_LOGIN}") + MEMBERSHIP_DATA=$(gh api orgs/${ORG_NAME}/memberships/${USER_LOGIN}) ERROR_CODE=$? if [ "${ERROR_CODE}" -ne 0 ]; then @@ -493,7 +493,7 @@ CheckAdminRights() { ################################################################################ #### Function isGHEC ########################################################### isCloud() { - ROOT_DATA=$(gh api "/") + ROOT_DATA=$(gh api //) USER_URL=$(echo -n "${ROOT_DATA}" | jq -r '.current_user_url') if [[ "${USER_URL}" != "https://api.github.com/user" ]]; then @@ -560,7 +560,7 @@ CheckAPILimit() { ############################################################## # Check what is remaining, and if 0, we need to sleep it off # ############################################################## - API_REMAINING_REQUEST=$(gh api "/rate_limit") + API_REMAINING_REQUEST=$(gh api rate_limit) API_REMAINING_MESSAGE=$(echo "${API_REMAINING_REQUEST}" | jq -r '.message' 2>&1) if [[ "${API_REMAINING_MESSAGE}" != "Rate limiting is not enabled." ]]; then