Skip to content

Instantly share code, notes, and snippets.

@samkahchiin
Created November 26, 2021 03:04
Show Gist options
  • Save samkahchiin/3d54f25ac5ecb08881aedb317d2c395e to your computer and use it in GitHub Desktop.
Save samkahchiin/3d54f25ac5ecb08881aedb317d2c395e to your computer and use it in GitHub Desktop.
Github Notification cronjob
#!/bin/bash
USER=$(git config user.email)
TOKEN=$(security find-generic-password -s github_token -w)
echo $USER
echo $TOKEN
echo 'Hi'
curl -s -u $USER:$TOKEN https://api.github.com/notifications \
| jq -r '.[] | select(.unread) | select(.reason == "review-requested") | [.subject.type, .reason, .subject.title] | @sh' \
| xargs -n 3 sh -c \
'terminal-notifier -title "GitHub Notification" -subtitle "$0 $1" -message "$2" -open "https://github.com/notifications"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment