Created
May 2, 2025 14:19
-
-
Save stand-sure/cc54afbad110606a348c8ae537de77f7 to your computer and use it in GitHub Desktop.
Lists open PRs under a root directory where the URL matches a pattern (useful for filtering to just one org)
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
#!/usr/bin/env bash | |
# open-prs.sh | |
__gh=/opt/homebrew/bin/gh | |
__jq=/opt/homebrew/bin/jq | |
while IFS= read -r -d '' dir | |
do | |
dir=$(dirname "$dir") | |
cd "$dir" || continue | |
__check=$("${__gh}" pr list --json title,url 2>/dev/null | "${__jq}" '.[] | select(.url | test("__REPLACE__THIS__")).title') | |
if [[ -n "$__check" ]]; then | |
pwd | |
"${__gh}" pr list --json title,url 2>/dev/null | "${__jq}" '.[] | select(.url | test("__REPLACE__THIS__")).title' | |
fi | |
cd - > /dev/null || exit | |
done < <(find . -name '.git' -type d -print0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment