Skip to content

Instantly share code, notes, and snippets.

@rhowardiv
Last active October 11, 2015 20:08
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 rhowardiv/3912807 to your computer and use it in GitHub Desktop.
Save rhowardiv/3912807 to your computer and use it in GitHub Desktop.
Get a random PR checker
#!/bin/bash
# Get a random PR checker
# Loops through everyone before showing the same name twice
ME=rhoward
# Takes optional argument for commit group if you want not from "ALL"
COMMIT_GROUP="ALL"
if [ $# -gt 0 ]; then
COMMIT_GROUP="$1"
fi
QFILE="/tmp/rpr$COMMIT_GROUP"
Q=$(cat "$QFILE")
if [ $? -ne 0 ]; then
echo -n "Creating random PR checker queue file..." 1>&2
touch "$QFILE"
echo "Done." 1>&2
fi
if [ -z "$Q" ]; then
Q=$(\
cat /home/$ME/ayi/classes/CodeManagement.php | \
sed -n "/'$COMMIT_GROUP' =>/,/),/p" | sed -e 1d -e \$d \
| grep -v "$ME\|msherov\|dkandpal\|dstraus" \
| cut -d "'" -f 2 \
| sort -R
)
fi
echo "$Q" | sed 1q
echo "$Q" | sed 1d > "$QFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment