Skip to content

Commit 1753035

Browse files
authored
📙 [just] check for Copilot and Claude reviews (#25)
* 📙 [just] check for Copilot and Claude reviews * fix filename reference
1 parent d050d52 commit 1753035

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

.just/gh-process.just

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ sync:
1414
git pull
1515
git stp
1616

17-
# PR create 3.2
17+
# PR create 3.3
1818
[group('Process')]
19-
pr: _has_commits
19+
pr: _has_commits && pr_checks
2020
#!/usr/bin/env bash
2121
set -euxo pipefail # strict mode
2222

@@ -27,12 +27,14 @@ pr: _has_commits
2727

2828
bodyfile=$(mktemp /tmp/justfile.XXXXXX)
2929

30-
echo "## Done:" >> $bodyfile
30+
echo "## Done" >> $bodyfile
3131
echo "" >> $bodyfile
3232
echo "- {{ last_commit_message }}" >> $bodyfile
3333
echo "" >> $bodyfile
3434
echo "" >> $bodyfile
35-
echo "(Automated in \`justfile\`.)" >> $bodyfile
35+
echo "## Meta" >> $bodyfile
36+
echo "" >> $bodyfile
37+
echo "(Automated in \`.just/gh-process.just\`.)" >> $bodyfile
3638

3739
echo ''
3840
cat "$bodyfile"
@@ -48,7 +50,6 @@ pr: _has_commits
4850

4951
echo "{{BLUE}}sleeping for 10s because github is lazy with their API{{NORMAL}}"
5052
sleep 10
51-
gh pr checks --watch -i 5
5253

5354
# merge PR and return to starting point
5455
[group('Process')]
@@ -119,4 +120,49 @@ _main_branch:
119120
# make a release
120121
[group('Process')]
121122
release rel_version:
122-
gh release create {{rel_version}} --generate-notes
123+
gh release create {{rel_version}} --generate-notes
124+
125+
# watch GHAs then check for Copilot suggestions
126+
[group('Process')]
127+
pr_checks:
128+
#!/usr/bin/env bash
129+
set -euo pipefail # bash strict mode
130+
131+
gh pr checks --watch -i 5
132+
133+
echo checking copilot...
134+
PR_META=$(gh pr view --json number,headRepository,headRepositoryOwner)
135+
PR_REPO_NAME=$(echo $PR_META | jq -r '.headRepository.name')
136+
PR_REPO_OWNER=$(echo $PR_META | jq -r '.headRepositoryOwner.login')
137+
PR_NUMBER=$(echo $PR_META | jq '.number')
138+
#echo "$PR_NUMBER $PR_REPO_OWNER/$PR_REPO_NAME"
139+
gh api graphql \
140+
-F owner=$PR_REPO_OWNER -F name=$PR_REPO_NAME -F pr=$PR_NUMBER \
141+
--jq '[ .data.repository.pullRequest.reviews.nodes.[] | select(.author.login=="copilot-pull-request-reviewer") | .comments.nodes.[] ]' \
142+
-f query='
143+
query($name: String!, $owner: String!, $pr: Int!) {
144+
repository(owner: $owner, name: $name) {
145+
pullRequest(number: $pr) {
146+
reviews(last: 20) {
147+
nodes {
148+
author {
149+
resourcePath
150+
login
151+
}
152+
comments(first: 100) {
153+
nodes {
154+
body
155+
path
156+
originalLine
157+
}
158+
}
159+
}
160+
}
161+
}
162+
}
163+
}
164+
'
165+
166+
# did Claude comment?
167+
echo -e "\n\n🟧🟠🔶🔸 Claude:"
168+
gh pr view --json comments --jq '[.comments[] | select(.author.login == "claude")] | last | .body'

0 commit comments

Comments
 (0)