Skip to content

Instantly share code, notes, and snippets.

@kylos101
Last active May 15, 2023 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylos101/3b36d667280614973a480ec114d7ec4f to your computer and use it in GitHub Desktop.
Save kylos101/3b36d667280614973a480ec114d7ec4f to your computer and use it in GitHub Desktop.
#!/bin/bash
# generate a friendly changelog
# gh auth login
# view gh auth status
# gh auth status
# given a json object with two arrays of PR links
TEAM=$(jq -r '.deployedPRs.team[]' < released.json)
ALL=$(jq -r '.deployedPRs.all[]' < released.json)
declare -A PR_LIST
for pr in ${TEAM}; do
PR_LIST["$pr"]=""
done
for pr in ${ALL}; do
PR_LIST["$pr"]=""
done
for pr in "${!PR_LIST[@]}"; do
PR_NUM=$(echo "$pr" | grep -Eo '[0-9]+$')
# echo $PR_NUM
REPO_ORG=$(grep -o '[^/]+/[^/]+$' <<< "$pr")
# echo $REPO_ORG
TITLE=$(gh pr view "$PR_NUM" --repo "$REPO_ORG" --json title | jq -r '.title')
# echo $TITLE
PR_LIST["$pr"]="$TITLE"
done
for pr in "${!PR_LIST[@]}"; do
echo "${PR_LIST[$pr]}" - "$pr"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment