Skip to content

Commit 7ba4bdf

Browse files
chore(workflows): simplify code review process by updating commit SHA retrieval and review.json structure
1 parent 32e54e8 commit 7ba4bdf

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

.github/workflows/code-review.yaml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,10 @@ jobs:
260260
261261
SUBMIT REVIEW:
262262
263-
COMMIT_SHA="\$(gh api repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER} --jq '.head.sha')"
264-
cat > review.json <<'EOF'
265-
{
266-
"event": "COMMENT",
267-
"commit_id": "COMMIT_SHA_HERE",
268-
"body": "## 🔍 Code Review\\n\\n[Your natural language summary here]\\n\\n---\\n*This comment was generated by an AI Agent through [Coder Tasks](https://coder.com/docs/ai-coder/tasks)*",
269-
"comments": [
270-
{"path": "file.go", "line": 123, "side": "RIGHT", "body": "Issue: [why]\\n\\n\`\`\`suggestion\\n[code]\\n\`\`\`"}
271-
]
272-
}
273-
EOF
274-
sed -i "s/COMMIT_SHA_HERE/\${COMMIT_SHA}/" review.json
275-
gh api repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER}/reviews --method POST --input review.json
263+
Get commit SHA: gh api repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER} --jq '.head.sha'
264+
Create review.json with this structure (comments array can have 0+ suggestions):
265+
{"event": "COMMENT", "commit_id": "[sha]", "body": "[summary with Coder Tasks link]", "comments": [comment1, comment2, ...]}
266+
Submit: gh api repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER}/reviews --method POST --input review.json
276267
277268
SUMMARY FORMAT (1-10 lines, natural language):
278269

0 commit comments

Comments
 (0)