11# git/gh process justfile
22
3+ # TODO: merge with hugo fork of this somehow
4+
35# some useful variables
46host := ` uname -n `
57release_branch := " main"
@@ -26,6 +28,7 @@ pr: _has_commits && pr_checks
2628 set + x # leave tracing off...
2729
2830 bodyfile=$(mktemp / tmp/ justfile .XXXXXX)
31+ #TODO: handle multiple commits on the branch
2932
3033 echo " ## Done" >> $bodyfile
3134 echo " " >> $bodyfile
@@ -78,8 +81,8 @@ _on_a_branch:
7881 # thanks to https://stackoverflow.com/a/12142066/2002471
7982
8083 if [[ $(git rev-parse --abbrev-ref HEAD) == " {{ release_branch }} " ]]; then
81- echo " {{ RED }} You are on branch '{{ release_branch }} ' (the release branch) so you are not ready to start a PR.{{ NORMAL }} "
82- exit 100
84+ echo " {{ RED }} You are on branch '{{ release_branch }} ' (the release branch) so you are not ready to start a PR.{{ NORMAL }} "
85+ exit 100
8386 fi
8487
8588# error if not on the release branch
@@ -94,8 +97,8 @@ _has_commits: _on_a_branch
9497 #echo $CURRENT_BRANCH
9598
9699 if [[ $(git cherry -v {{ release_branch }} " $CURRENT_BRANCH" | wc -l) -eq 0 ]]; then
97- echo " You are on a branch that {{ RED }} does not have any commits{{ NORMAL }} ."
98- exit 101
100+ echo " You are on a branch that {{ RED }} does not have any commits{{ NORMAL }} ."
101+ exit 101
99102 fi
100103
101104# error if not on the release branch
@@ -107,8 +110,8 @@ _main_branch:
107110 # thanks to https://stackoverflow.com/a/12142066/2002471
108111
109112 if [[ ! $(git rev-parse --abbrev-ref HEAD) == " {{ release_branch }} " ]]; then
110- echo " You are on a {{ BLUE }} branch that is not the release branch{{ NORMAL }} so you are not ready to start a new branch."
111- exit 102
113+ echo " You are on a {{ BLUE }} branch that is not the release branch{{ NORMAL }} so you are not ready to start a new branch."
114+ exit 102
112115 fi
113116
114117# print UTC date in ISO format
@@ -129,39 +132,39 @@ pr_checks:
129132
130133 gh pr checks --watch -i 5
131134
132- echo checking copilot ...
135+ echo " 🐈⬛😾 Copilot suggestions ..."
133136 PR_META=$(gh pr view --json number,headRepository,headRepositoryOwner)
134137 PR_REPO_NAME=$(echo $PR_META | jq -r ' .headRepository.name' )
135138 PR_REPO_OWNER=$(echo $PR_META | jq -r ' .headRepositoryOwner.login' )
136139 PR_NUMBER=$(echo $PR_META | jq ' .number' )
137140 #echo "$PR_NUMBER $PR_REPO_OWNER/$PR_REPO_NAME"
138141 gh api graphql \
139- - F owner=$PR_REPO_OWNER -F name=$PR_REPO_NAME -F pr=$PR_NUMBER \
140- - -jq ' [ .data.repository.pullRequest.reviews.nodes.[] | select(.author.login=="copilot-pull-request-reviewer") | .comments.nodes.[] ]' \
141- - f query='
142- query($name: String!, $owner: String!, $pr: Int!) {
143- repository(owner: $owner, name: $name) {
144- pullRequest(number: $pr) {
145- reviews(last: 20) {
146- nodes {
147- author {
148- resourcePath
149- login
150- }
151- comments(first: 100) {
152- nodes {
153- body
154- path
155- originalLine
156- }
142+ - F owner=$PR_REPO_OWNER -F name=$PR_REPO_NAME -F pr=$PR_NUMBER \
143+ - -jq ' [ .data.repository.pullRequest.reviews.nodes.[] | select(.author.login=="copilot-pull-request-reviewer") | .comments.nodes.[] ]' \
144+ - f query='
145+ query($name: String!, $owner: String!, $pr: Int!) {
146+ repository(owner: $owner, name: $name) {
147+ pullRequest(number: $pr) {
148+ reviews(last: 20) {
149+ nodes {
150+ author {
151+ resourcePath
152+ login
153+ }
154+ comments(first: 100) {
155+ nodes {
156+ body
157+ path
158+ originalLine
159+ }
160+ }
161+ }
162+ }
157163 }
158- }
159164 }
160- }
161165 }
162- }
163- '
166+ '
164167
165- # did Claude comment?
166- echo -e " \n\n 🟧🟠🔶🔸 Claude:"
167- gh pr view --json comments --jq ' [.comments[] | select(.author.login == "claude")] | last | .body'
168+ # did Claude comment?
169+ echo -e " \n\n 🟧🟠🔶🔸 Claude:"
170+ gh pr view --json comments --jq ' [.comments[] | select(.author.login == "claude")] | last | .body'
0 commit comments