Created
July 5, 2024 10:24
-
-
Save pybites/b2c3be22e3f395cf09f9b2906effec22 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# brew or apt-get install gh jq fzf | |
CACHE_FILE=~/.gh_repos.json | |
CACHE_DURATION=$((60*60*24*3)) # 3 days in seconds | |
if [ ! -f "$CACHE_FILE" ] || [ $(( $(date +%s) - $(stat -c %Y "$CACHE_FILE") )) -ge $CACHE_DURATION ]; then | |
echo "Refreshing cache..." | |
gh api user/repos --paginate > "$CACHE_FILE" | |
fi | |
# Search and open repository | |
jq '.[] | select(.permissions.push == true) | .full_name' "$CACHE_FILE" \ | |
| fzf \ | |
| xargs -I{} gh repo view {} --web |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment