Skip to content

Instantly share code, notes, and snippets.

@Stoffo
Last active May 8, 2019 16:17
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 Stoffo/f70117f54e32430e5018896cdd82dfdb to your computer and use it in GitHub Desktop.
Save Stoffo/f70117f54e32430e5018896cdd82dfdb to your computer and use it in GitHub Desktop.
Checks The GitHub API for Pull Requests to Review and changes the color of Anybar
#!/usr/bin/env bash
GITHUB_USERNAME=
GITHUB_AUTH_TOKEN=
GITHUB_SEARCH_QUERY="is:open%20is:pr%20review-requested:Stoffo%20archived:false"
change_anybar_color () {
echo -n $1 | nc -4u -w0 localhost 1738
}
change_anybar_color "question"
PULL_REQUEST_COUNT=$(curl -s -u ${GITHUB_USERNAME}:${GITHUB_AUTH_TOKEN} 'https://api.github.com/search/issues?q=${GITHUB_SEARCH_QUERY}' | jq .total_count)
echo ${PULL_REQUEST_COUNT}
if [ "${PULL_REQUEST_COUNT}" -gt 0 ]; then
change_anybar_color "exclamation"
else
change_anybar_color "green"
fi
@Stoffo
Copy link
Author

Stoffo commented May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment