mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-29 20:21:50 +02:00
Add script to pr review
This commit is contained in:
24
scripts/pr-review.sh
Executable file
24
scripts/pr-review.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Checking a pr using hub
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
require() {
|
||||||
|
if [[ -z $(command -v "$1" 2>/dev/null) ]]; then
|
||||||
|
echo " 🛑 Please install $1 and try again"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require jq
|
||||||
|
require gh
|
||||||
|
require fzf
|
||||||
|
|
||||||
|
prd="$(gh pr list --json 'number,title' | jq -r '.[]| [.number, .title] | @sh' | column -t -s"'" | fzf)"
|
||||||
|
[ -z "$prd" ] && echo "No PR selected" && exit 0
|
||||||
|
|
||||||
|
pr_id="$(echo "$prd" | awk '{print $1}')"
|
||||||
|
|
||||||
|
gh pr view "$pr_id" --json "files" | jq -r '.files|map(.path)|.[]'
|
||||||
|
gh pr checkout "$pr_id"
|
Reference in New Issue
Block a user