Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4001fe5
feat: add code-review task (initial commit)
DevelopmentCats Dec 4, 2025
c6b85ec
temp(workflows): update code-review workflow to use shared secrets fo…
DevelopmentCats Dec 4, 2025
2fea873
refactor: enhance code-review workflow with improved GitHub authentic…
DevelopmentCats Dec 4, 2025
84ccad8
chore: enhance code-review workflow with URL validation and improved …
DevelopmentCats Dec 4, 2025
d94e9df
refactor: update code-review workflow to enhance review phases and su…
DevelopmentCats Dec 4, 2025
724e8b1
fix: security vuln in linting
DevelopmentCats Dec 9, 2025
96e6afd
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 9, 2025
647b610
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 10, 2025
c7c96e9
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 10, 2025
c5fe6c5
chore(workflows): add security instructions for PR content review
DevelopmentCats Dec 10, 2025
96c66d6
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 10, 2025
62bf201
chore(workflows): streamline code review process and enhance security…
DevelopmentCats Dec 11, 2025
ca4dd32
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 11, 2025
dcaedbd
chore(workflows): update code review prompt for critical suggestion i…
DevelopmentCats Dec 11, 2025
ff8d037
chore(workflows): enhance code review instructions for suggestion for…
DevelopmentCats Dec 11, 2025
a26b00f
chore(workflows): rewrite prompt
DevelopmentCats Dec 11, 2025
595278f
chore(workflows): update code review guidelines to include Coder-spec…
DevelopmentCats Dec 11, 2025
50dc5c0
chore(workflows): refine code review guidelines to emphasize actionab…
DevelopmentCats Dec 11, 2025
8ab152f
chore(workflows): update code review guidelines to address additional…
DevelopmentCats Dec 11, 2025
3d1dd32
chore(workflows): clarify code review guidelines regarding the use of…
DevelopmentCats Dec 11, 2025
5d9492b
chore: apply code-review suggestion for gnu specific syntax
DevelopmentCats Dec 11, 2025
32e54e8
chore(workflows): update code review comments to include Coder Tasks …
DevelopmentCats Dec 11, 2025
7ba4bdf
chore(workflows): simplify code review process by updating commit SHA…
DevelopmentCats Dec 11, 2025
f0eaa46
chore(workflows): improve portability of PR number extraction by repl…
DevelopmentCats Dec 11, 2025
d6cdd8f
Merge branch 'main' into cat/code-review-task
DevelopmentCats Dec 12, 2025
50281ce
chore(workflows): enhance code review instructions with clearer guide…
DevelopmentCats Dec 12, 2025
fb144d5
chore(workflows): update code review guidelines to enhance clarity an…
DevelopmentCats Dec 12, 2025
9a5f70f
chore(workflows): improve error handling and clarify set -u behavior …
DevelopmentCats Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(workflows): enhance code review instructions for suggestion for…
…matting
  • Loading branch information
DevelopmentCats committed Dec 11, 2025
commit ff8d037be3f936162b0afda0ffc559f13464dc05
65 changes: 46 additions & 19 deletions .github/workflows/code-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ jobs:
1. Read the entire PR diff and understand what it does
2. Read full file content for files you'll comment on (verify issues exist)
3. Identify real issues (security bugs, logic errors, missing error handling)
4. For each issue, verify it's actually wrong and would impact functionality
4. For each issue:
- Verify it's actually wrong and would impact functionality
- Determine exact line(s) to comment on: single line OR range (start_line to line)
- Write ONLY the replacement code in suggestion block, not surrounding context
5. Submit ONE review with inline comments

IMPORTANT: Finding 0 issues is valid - don't invent problems.
Expand All @@ -180,27 +183,26 @@ jobs:

CRITICAL: GITHUB SUGGESTION BLOCKS

Your suggestion REPLACES the commented line. Don't include surrounding context.
Your suggestion REPLACES the commented lines. Match the exact scope.

Example - File has these lines:
SINGLE-LINE FIX - File has these lines:
49: # Extract PR number
50: PR_NUM=\$(echo "\$URL" | grep -oP '\\d+')
51: echo "pr_num=\${PR_NUM}"

❌ WRONG - commenting on line 50:
\`\`\`suggestion
# Extract PR number
PR_NUM=\$(echo "\$URL" | sed 's|.*/\\([0-9]*\\)$|\\1|')
echo "pr_num=\${PR_NUM}"
\`\`\`
Result: Lines 49 and 51 now appear twice. Broken!

✅ CORRECT - commenting on line 50:
\`\`\`suggestion
PR_NUM=\$(echo "\$URL" | sed 's|.*/\\([0-9]*\\)$|\\1|')
\`\`\`
❌ WRONG - commenting on line 50 but including surrounding lines:
{"line": 50, "body": "Fix regex\n\n\`\`\`suggestion\n# Extract PR number\nPR_NUM=\$(echo \"\$URL\" | sed 's|.*/\\([0-9]*\\)$|\\1|')\necho \"pr_num=\${PR_NUM}\"\n\`\`\`"}
Result: Lines 49 and 51 now duplicated. Broken!

✅ CORRECT - commenting on line 50 only:
{"line": 50, "body": "Fix regex\n\n\`\`\`suggestion\nPR_NUM=\$(echo \"\$URL\" | sed 's|.*/\\([0-9]*\\)$|\\1|')\n\`\`\`"}
Result: Only line 50 is replaced. Perfect!

MULTI-LINE FIX - To replace lines 50-51 with multiple new lines:
✅ CORRECT:
{"start_line": 50, "line": 51, "body": "Add error handling\n\n\`\`\`suggestion\nif [[ -z \"\${URL}\" ]]; then\n echo \"Error: URL is empty\"\n exit 1\nfi\nPR_NUM=\$(sed 's|.*/\\([0-9]*\\)$|\\1|' <<<\"\$URL\")\n\`\`\`"}
Result: Lines 50-51 replaced with 5 new lines. The suggestion can be any number of lines!

HOW TO SUBMIT THE REVIEW:

Step 1: Get commit SHA
Expand All @@ -217,7 +219,14 @@ jobs:
"path": "path/to/file.go",
"line": 123,
"side": "RIGHT",
"body": "**Issue:** [What's wrong and why]\n\n\`\`\`suggestion\n[Fixed code]\n\`\`\`"
"body": "**Issue:** [What's wrong and why]\n\n\`\`\`suggestion\n[Fixed single line]\n\`\`\`"
},
{
"path": "path/to/other.go",
"start_line": 50,
"line": 52,
"side": "RIGHT",
"body": "**Issue:** [Multi-line issue]\n\n\`\`\`suggestion\n[Line 1 of replacement]\n[Line 2 of replacement]\n[Line 3 of replacement]\n[As many lines as needed]\n\`\`\`"
}
]
}
Expand All @@ -228,10 +237,28 @@ jobs:
gh api repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER}/reviews --method POST --input review.json

INLINE COMMENT FORMAT:
Single-line comment (replace line 50):
{
"path": "file.go",
"line": 50,
"side": "RIGHT",
"body": "Issue\n\n\`\`\`suggestion\n[replacement - can be 1 or many lines]\n\`\`\`"
}

Multi-line comment (replace lines 50-52 with any number of new lines):
{
"path": "file.go",
"start_line": 50,
"line": 52,
"side": "RIGHT",
"body": "Issue\n\n\`\`\`suggestion\n[line 1]\n[line 2]\n[line 3]\n[as many as needed]\n\`\`\`"
}

- path: relative path from repo root (no leading /)
- line: line number (integer)
- side: "RIGHT" (for new/changed code)
- body: Issue description + \`\`\`suggestion block
- line: last line to replace (or only line for single-line)
- start_line: first line to replace (only needed for multi-line)
- side: always "RIGHT" (for new/changed code)
- Suggestion block can contain any number of lines

QUALITY GUIDELINES:
- Only comment on real issues that matter
Expand Down
Loading