Skip to content

Commit

Permalink
debugging where base 64 is going wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
amenocal committed Mar 29, 2024
1 parent 8048ae4 commit a691b1e
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions gh-repo-stats
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ ParseRepos() {
PARSE_DATA=$1

REPOS=$(echo "${PARSE_DATA}" | jq -r '.data.organization.repositories.nodes')
echo "decoding repos"
echo "${REPOS}"
for REPO_DATA in $(echo -n "${REPOS}" | jq -r '.[] | @base64'); do
_jq() {
echo -n "${REPO_DATA}" | base64 --decode | jq -r "${1}"
Expand Down Expand Up @@ -848,6 +850,8 @@ ParseRepoData() {
# Pull in the repos data block
REPO_DATA=$1
# Convert the format to JSON
echo "decoding repo data"
echo "${REPO_DATA}"
_jq() {
echo -n "${REPO_DATA}" | base64 --decode | jq -r "${1}"
}
Expand Down Expand Up @@ -970,7 +974,8 @@ ParseRepoData() {
#### Function AnalyzeIssues ####################################################
AnalyzeIssues() {
THIS_REPO=$1

echo "decoding AnalyzeIssues THIS_REPO"
echo "${THIS_REPO}"
_pr_issue_jq() {
echo -n "${THIS_REPO}" | base64 --decode | jq -r "${1}"
}
Expand All @@ -986,7 +991,8 @@ AnalyzeIssues() {
# Get the Current End Cursor #
##############################
ISSUE_NEXT_PAGE=$(_pr_issue_jq '.issues.pageInfo.endCursor')

echo "decoding ISSUES"
echo "${ISSUES}"
for ISSUE in $(echo -n "${ISSUES}" | jq -r '.[] | @base64'); do
_issue_jq() {
echo -n "${ISSUE}" | base64 --decode | jq -r "${1}"
Expand Down Expand Up @@ -1071,7 +1077,8 @@ GetNextIssues() {
echo "ERROR --- Errors occurred while retrieving issues for repo: ${REPO_NAME}"
echo "${ERROR_MESSAGE}" | jq '.'
fi

echo "deocding ISSUE_REPO"
echo "${ISSUE_REPO}"
ISSUE_REPO=$(echo -n "${ISSUE_DATA}" | jq -r '.data.repository | @base64')

######################
Expand All @@ -1084,7 +1091,8 @@ GetNextIssues() {
#### Function AnalyzePullRequests ##############################################
AnalyzePullRequests() {
PR_REPO=$1

echo "decoding AnalyzePullRequests PR_REPO"
echo "${PR_REPO}"
_pr_repo_jq() {
echo -n "${PR_REPO}" | base64 --decode | jq -r "${1}"
}
Expand All @@ -1102,7 +1110,8 @@ AnalyzePullRequests() {
# Get the Current End Cursor #
##############################
PR_NEXT_PAGE=$(_pr_repo_jq '.pullRequests.pageInfo.endCursor')

echo "decoding PRS"
echo "${PRS}"
for PR in $(echo -n "${PRS}" | jq -r '.[] | @base64'); do
_pr_jq() {
echo -n "${PR}" | base64 --decode | jq -r "${1}"
Expand Down Expand Up @@ -1232,7 +1241,8 @@ GetNextPullRequests() {
echo "ERROR --- Errors occurred while retrieving pull requests for repo: ${REPO_NAME}"
echo "${ERROR_MESSAGE}" | jq '.'
fi

echo "decoding PR_REPO"
echo "${/PR_REPO}"
PR_REPO=$(echo -n "${PR_DATA}" | jq -r '.data.repository | @base64')

AnalyzePullRequests "${PR_REPO}"
Expand All @@ -1242,7 +1252,8 @@ GetNextPullRequests() {
#### Function AnalyzeReviews ###################################################
AnalyzeReviews() {
REVIEW_PR=$1

echo "decoding AnalyzeReviews REVIEW_PR"
echo "${REVIEW_PR}"
_review_jq() {
echo -n "${REVIEW_PR}" | base64 --decode | jq -r "${1}"
}
Expand All @@ -1261,7 +1272,8 @@ AnalyzeReviews() {
PR_NUMBER=$(_review_jq '.number')

Debug "Analyzing Pull Request Reviews for: ${REPO_NAME} PR: ${PR_NUMBER}"

echo "decoding REVIEWS"
echo "${REVIEWS}"
for REVIEW in $(echo -n "${REVIEWS}" | jq -r '.[] | @base64'); do
_pr_jq() {
echo -n "${REVIEW}" | base64 --decode | jq -r "${1}"
Expand Down Expand Up @@ -1368,6 +1380,8 @@ GetNextReviews() {
#####################
# Get the Review PR #
#####################
echo "decoding REVIEW_PR"
echo "${REVIEW_PR}"
REVIEW_PR=$(echo -n "${REVIEW_DATA}" | jq -r '.data.repository.pullRequest | @base64')

######################
Expand Down Expand Up @@ -1425,7 +1439,8 @@ GetTeams() {
# Get the Current End Cursor #
##############################
TEAM_NEXT_PAGE=$(echo "${TEAM_DATA}" | jq -r '.data.organization.teams.pageInfo.endCursor')

echo "decoding teams"
echo "${TEAMS}"
for TEAM in $(echo -n "${TEAMS}" | jq -r '.[] | @base64'); do
_team_jq() {
echo -n "${TEAM}" | base64 --decode | jq -r "${1}"
Expand Down

0 comments on commit a691b1e

Please sign in to comment.