Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created February 19, 2023 16:51
Show Gist options
  • Save KyMidd/289d04e2af8728969e4647e17589aaa1 to your computer and use it in GitHub Desktop.
Save KyMidd/289d04e2af8728969e4647e17589aaa1 to your computer and use it in GitHub Desktop.
for PROJECT in $(echo $EHR_RELATED_STASH_PROJECTS); do
echo "💥 Working on project $PROJECT"
# Find slug of all repos in a project
unset PROJECT_REPOS
PROJECT_REPOS=$(curl -s --user $STASH_USER:$STASH_PASS https://$STASH_URL/rest/api/1.0/projects/$PROJECT/repos\?limit\=$PR_LIMIT | jq -r '.values[].slug')
# Iterate over each repo to find all PRs, read limit from var
for REPO in $(echo $PROJECT_REPOS); do
echo "Working on repo $REPO"
unset AUTHOR_USER_NAMES
unset REVIEWER_USER_NAMES
AUTHOR_USER_NAMES=$(curl -s --user $STASH_USER:$STASH_PASS https://$STASH_URL/rest/api/1.0/projects/$PROJECT/repos/$REPO/pull-requests\?state\=ALL\&limit\=$USER_LIMIT | jq -r '.values[].author.user.name' | sort | uniq)
REVIEWER_USER_NAMES=$(curl -s --user $STASH_USER:$STASH_PASS https://$STASH_URL/rest/api/1.0/projects/$PROJECT/repos/$REPO/pull-requests\?state\=ALL\&limit\=$USER_LIMIT | jq -r '.values[].reviewers[].user.name' | sort | uniq)
echo $AUTHOR_USER_NAMES | tr " " "\n" >> users
echo $REVIEWER_USER_NAMES | tr " " "\n" >> users
done
done
# Sort, uniq
cat users | sort | uniq > users_sorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment