Skip to content

Commit

Permalink
Repo list (#30)
Browse files Browse the repository at this point in the history
* adding list

* fix errors

* change var vname as its hangry?

* fixed error in var names

* adding more debug

* fix loop

* fix elif
  • Loading branch information
admiralAwkbar authored Jun 13, 2022
1 parent e081179 commit 3f9c20d
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions gh-repo-stats
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,12 @@ EOF

REPO_RESPONSE_CODE="${REPO_RESPONSE:(-3)}"
DATA_BLOCK="${REPO_RESPONSE::${#REPO_RESPONSE}-4}"

if [[ "$REPO_RESPONSE_CODE" != "200" ]]; then

if [[ "$REPO_RESPONSE_CODE" == "502" ]]; then
# We are using to big of a page size, so we need to do smaller pagination
echo "Error 502: We are using to big of a page size, so we need to do smaller pagination"
echo "Please set --repo-page-size to a lower value"
elif [[ "$REPO_RESPONSE_CODE" != "200" ]]; then
echo "Error getting Repos for Org: ${ORG_NAME}"
echo "${DATA_BLOCK}"
else
Expand Down Expand Up @@ -824,27 +828,27 @@ ParseRepos() {
ParseRepoData "${REPO_DATA}"
fi
done
fi

#################################################################
# Need to check if this repo has already been parsed in the doc #
#################################################################
grep "${OWNER},${REPO_NAME}," "${OUTPUT_FILE_NAME}" >/dev/null 2>&1

#######################
# Load the error code #
#######################
ERROR_CODE=$?

##############################
# Check the shell for errors #
##############################
if [ ${ERROR_CODE} -eq 0 ]; then
# Found this in the csv already
echo "Repo:[${OWNER}/${REPO_NAME}] has previously been analyzed, moving on..."
elif [ ${ERROR_CODE} -ne 0 ] && [[ -z "${REPO_LIST_FILE}" ]]; then
echo "Analyzing Repo: ${REPO_NAME}"
ParseRepoData "${REPO_DATA}"
else
#################################################################
# Need to check if this repo has already been parsed in the doc #
#################################################################
grep "${OWNER},${REPO_NAME}," "${OUTPUT_FILE_NAME}" >/dev/null 2>&1

#######################
# Load the error code #
#######################
ERROR_CODE=$?

##############################
# Check the shell for errors #
##############################
if [ ${ERROR_CODE} -eq 0 ]; then
# Found this in the csv already
echo "Repo:[${OWNER}/${REPO_NAME}] has previously been analyzed, moving on..."
elif [ ${ERROR_CODE} -ne 0 ] && [[ -z "${REPO_LIST_FILE}" ]]; then
echo "Analyzing Repo: ${REPO_NAME}"
ParseRepoData "${REPO_DATA}"
fi
fi
done
}
Expand Down Expand Up @@ -1045,11 +1049,14 @@ EOF
ISSUE_RESPONSE_CODE="${ISSUE_RESPONSE:(-3)}"
ISSUE_DATA="${ISSUE_RESPONSE::${#ISSUE_RESPONSE}-4}"

if [[ "${ISSUE_RESPONSE_CODE}" != "200" ]]; then
if [[ "${ISSUE_RESPONSE_CODE}" == "502" ]]; then
# We need to use a smaller page size
echo "Error 502: We are using to big of a page size, so we need to do smaller pagination"
echo "Please set --extra-page-size to a lower value"
elif [[ "${ISSUE_RESPONSE_CODE}" != "200" ]]; then
echo "Error getting more Issues for Repo: ${OWNER}/${REPO_NAME}"
echo "${ISSUE_DATA}"
else

Debug "ISSUE DATA BLOCK:"
DebugJQ "${ISSUE_DATA}"

Expand Down

0 comments on commit 3f9c20d

Please sign in to comment.