Skip to content

Instantly share code, notes, and snippets.

@fritzy
Last active March 2, 2023 21:06
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 fritzy/6f2121ec8b2aeb1994664ce408a2aba4 to your computer and use it in GitHub Desktop.
Save fritzy/6f2121ec8b2aeb1994664ce408a2aba4 to your computer and use it in GitHub Desktop.
Get random issues of a given labels from a repo
#!/bin/bash
# Usage: issues [label/p0-2] [limit] [pool_size]
# requires gh (github cli)
POOL_SIZE=${3:-50}
LIMIT=${2:-5}
LABEL=${1:-"Needs Triage"}
REPO="https://github.com/npm/cli"
if [[ $LABEL = "triage" ]];
then
LABEL='Needs Triage'
elif [[ $LABEL = "p1" ]];
then
LABEL='Priority 1'
elif [[ $LABEL = "p2" ]];
then
LABEL='Priority 2'
elif [[ $LABEL = "p0" ]];
then
LABEL='Priority 0'
fi
echo "issues [label/p0-2] [limit] [pool_size]"
echo "issues \"$LABEL\" $LIMIT $POOL_SIZE"
echo "--"
echo
lines=$(gh issue list -R "$REPO" -L $POOL_SIZE -l "$LABEL" | sort -R | head -n $LIMIT)
IFS="\n"
while read -r line; do
bug=$(awk '{print $1;}' <<< "$line")
desc=$(echo "$line" | cut -d" " -f2- | cut -d$'\t' -f1)
printf '%s\n%s/issues/%s\n\n' "$desc" "$REPO" "$bug"
done <<< "$lines"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment