Last active
March 2, 2023 21:06
-
-
Save fritzy/6f2121ec8b2aeb1994664ce408a2aba4 to your computer and use it in GitHub Desktop.
Get random issues of a given labels from a repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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