- Gets PRs from the main GSC repo (github.com/gospotcheck/gospotcheck) that have a
review requested
label applied to them - If you have at least 1 PR to review, it pops open a Mac notifier message that tells you how many PRs are in the
review requested
state - Allows you to click the notification to go straight to the pull requests page
get_review_requested_pull_requests
- Requires
jq
to be installed via homebrew - Requires the
terminal-notifier
ruby gem
This requires that you have the following variables in your fish config:
GITHUB_API_TOKEN
created and obtained on GitHub in your personal account
Place the following code in in ~/.config/fish/functions/get_review_requested_pull_requests.fish
function get_review_requested_pull_requests
set -l needs_review_count (curl -H "Authorization: bearer $GITHUB_API_TOKEN" -X GET https://api.github.com/repos/gospotcheck/gospotcheck/pulls | jq '.[] | {url, labels: [.labels[]]}' | jq 'select(contains({labels: [{name: "review requested"}]}))' | jq '.url' | wc -l | awk '{$1=$1};1')
if [ $needs_review_count != "0" ]
set -l pr_text "PRs"
if [ $needs_review_count = "1" ]
set pr_text "PR"
end
terminal-notifier -message "You have $needs_review_count new $pr_text to review. Click to go to GitHub." -title "Time to party!" -open https://github.com/gospotcheck/gospotcheck/pulls
end
end