← Back to list

gerrit-comment
by XuNeo
⭐ 6🍴 0📅 Jan 21, 2026
SKILL.md
name: gerrit-comment description: Fetch and post Gerrit review comments (as JSON) for a given change URL, change number, or Change-Id. Use when you need real review feedback for code fixes or want to post automated review comments.
Get Comments
Fetch published review comments from a Gerrit change.
python3 scripts/get_comments.py --change "<change>" [--revision "<revision>"] [--all]
--change: Full URL (e.g.,https://gerrit.example.com/c/repo/+/12345), change number, or Change-Id--revision: Optional. SHA, patch set number, orcurrent--all: Optional. Show all threads (default: only unresolved threads)
Post Comments
Post review comments to a Gerrit change.
python3 scripts/post_comment.py --change "<change>" [options]
Basic Options
--change: Required. Full URL, change number, or Change-Id--revision: Optional. SHA, patch set number, orcurrent--message: Optional. Overall review message--tag: Optional. Tag for the review (e.g.,autogenerated:ci)
Inline Comment Options
--file: File path for inline comment--line: Line number (1-based)--range: Range as JSON:{"start_line":1,"start_character":0,"end_line":5,"end_character":10}--reply-to: Comment ID to reply to--unresolved: Mark comment as unresolved (default for new comments)--resolved: Mark comment as resolved
Vote Options
--labels: Labels as JSON:{"Code-Review": 1, "Verified": 1}
Batch Comments
--comments-json: JSON string or@filepathwith batch comments
Examples
Post a simple review message:
python3 scripts/post_comment.py --change 12345 --message "LGTM"
Post an inline comment:
python3 scripts/post_comment.py --change 12345 --file "src/main.py" --line 10 --message "Consider using a constant here"
Post with vote:
python3 scripts/post_comment.py --change 12345 --message "Approved" --labels '{"Code-Review": 1}'
Post batch comments from file:
python3 scripts/post_comment.py --change 12345 --comments-json @review.json
Batch JSON format:
{
"message": "Overall review message",
"tag": "autogenerated:my-tool",
"labels": {"Code-Review": 1},
"comments": {
"src/main.py": [
{"line": 10, "message": "Comment 1"},
{"line": 20, "message": "Comment 2", "unresolved": true}
]
}
}
Fetch Code
To fetch the code for a specific patch set:
git fetch {REMOTE} refs/changes/{XX}/{CHANGE_NUMBER}/{PATCH_SET_NUMBER}
- XX is the last two digits of the change number (e.g., for 12345, XX = 45)
- CHANGE_NUMBER is the full change number
- PATCH_SET_NUMBER is the specific patch set number (use latest_patchset from get_comments output)
Environment
| Variable | Required |
|---|---|
GERRIT_USER | Yes |
GERRIT_HTTP_PASSWORD | Yes |
GERRIT_BASE_URL | Only when using change number/ID |
Output
Get Comments Success
{
"change": "12345",
"latest_patchset": 3,
"unresolved_only": true,
"thread_count": 1,
"threads": [
{
"file": "path/to/file.c",
"range": {"start_line": 10, "start_character": 0, "end_line": 10, "end_character": 5},
"line": 10,
"unresolved": true,
"updated": "2026-01-13 11:57:15.000000000",
"comments": [
{
"id": "...",
"in_reply_to": null,
"patch_set": 1,
"author": "Alice",
"message": "...",
"updated": "...",
"unresolved": true
}
]
}
]
}
Post Comment Success
{
"change": "12345",
"revision": "current",
"success": true,
"response": {}
}
Error
{
"change": "12345",
"revision": null,
"error": {"type": "GerritError", "message": "..."}
}
Dependency
pip3 install python-gerrit-api
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon