Limitations
-
Requires a valid combination of
owner,repo,pull_number,commit_id,path, and location fields likelineorposition, and optionalstart_line/start_sidethat map to a real line in the pull request diff. Invalid locations will cause the action to fail. - Like other GitHub actions, calls are subject to GitHub API rate limits. Heavy automation or tight loops can cause intermittent failures until rate limits reset.
Prerequisites
- Your admin must install and configure the GitHub connector, add the GitHub actions pack under Admin > Actions, and enable this action. For more information see GitHub actions setup.
- A GitHub app must be installed on the relevant organization(s) and linked to the correct GitHub datasource in the Glean admin console.
- You must authenticate for GitHub actions so the action can run using your GitHub identity. Your identity must have permission to view the diff and post review comments in the target repository.
Parameters
| Parameter | Type | Description |
|---|---|---|
| Comment body | String | Text content of the review comment. |
| Commit ID | String | The commit SHA that the comment should be associated with. |
| Owner | String | Owner of the repository that contains the pull request. |
| File path | String | File path in the repository where you want to add the comment. |
| Pull request number | Integer | Number of the pull request to comment on. |
| Repository | String | Name of the repository that contains the pull request. |
| Reply to comment | Integer | ID of an existing review comment if you want to reply in an existing review thread instead of creating a new one. |
| Line number | Integer | Line number in the file where the comment should appear (for unified diff mode). Use either line or position depending on how your agent computes locations. |
| Position | Integer | Position in the diff where the comment should appear (for diff-based positioning). Use either line or position. |
| Side | String | Side of the diff to comment on, for example the original or the modified side of the change. |
| Start line | Integer | Starting line number for a multi-line comment range. |
| Start side | String | Side of the diff for the starting line of a multi-line comment range. |
| Subject type | String | Type of subject the comment applies to, for example a line or file-level comment, depending on how the underlying API is configured. |
Usage example
You are reviewing a pull request and notice a function is missing documentation. You want to leave a comment on that specific line suggesting the author add documentation. Instruction to an agent: “Add a review comment to pull request #127 in mycompany/backend repository at line 45 in the file src/api/users.py, suggesting that the function needs documentation.” Resulting behavior:- Calls Get a pull request to retrieve details for PR #127 including the latest commit SHA.
-
Calls Create a review comment for a pull request with:
-
Ownerset to “mycompany”. -
Repositoryset to “backend”. -
Pull request numberset to 127. -
Commit IDset to the latest commit SHA (for example, “abc123def456”). -
File pathset to “src/api/users.py”. -
Line numberset to 45. -
Sideset to “RIGHT” to comment on the modified version. -
Comment bodyset to “Please add documentation for this function explaining the parameters, return value, and any exceptions it may raise.”
-
- Creates a review comment on the pull request at the specified line.
- The comment appears in the pull request diff view attached to line 45 of the file.
- The pull request author receives a notification about the new comment.
Start line and Start side parameters. Combine with other GitHub actions like requesting reviewers or listing commits to build comprehensive code review agents.
Troubleshooting
Action fails for a specific pull request
Action fails for a specific pull request
- Possible cause: The
owner,repository, orpull_numbervalues do not match an existing pull request that is available through your GitHub connector, or the authenticated identity cannot access that pull request. - Fix: Confirm that the repository is connected in Glean, the pull request exists in GitHub, and the identifiers you passed match the pull request.
Action succeeds intermittently or stops working after many rapid calls
Action succeeds intermittently or stops working after many rapid calls
- Possible cause: Hitting GitHub API rate limits.
- Fix: Reduce how frequently the action is called, add delays between calls, or batch comments where possible. If this keeps happening, contact your Glean admin to review configuration and usage.
Action appears unavailable or you see an authentication or permission error
Action appears unavailable or you see an authentication or permission error
FAQs
Does this action submit an approve or request-changes review?
Does this action submit an approve or request-changes review?
No. This action creates individual review comments. To submit a full review (approve or request changes), use the separate GitHub actions that create or submit a review for a pull request, and combine them with this action if you need both behaviors.
Can I use this action without specifying an exact line?
Can I use this action without specifying an exact line?
No. You must provide enough location information such as
commit_id, path, and either line or position for GitHub to attach the comment to a specific place in the pull request diff.