Describe the bug
When using GitHub CLI to fetch PR comments from a private repository that the authenticated user has access to, the commands return '404 Not Found' errors even though the user can access the repository and PR through the web interface.
Steps to reproduce
- Authenticate with a GitHub token that has access to a private repository
- Run
gh pr view --json number,headRepository (works correctly)
- Run
gh api /repos/{owner}/{repo}/issues/{pr_number}/comments
- Run
gh api /repos/{owner}/{repo}/pulls/{pr_number}/comments
Expected behavior
The commands should return the PR comments in JSON format, similar to how they work for public repositories.
Actual behavior
Both commands return:
gh: Not Found (HTTP 404)
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#list-issue-comments","status":"404"}
Environment
- GitHub CLI version: $(gh --version | head -1)
- Operating system: macOS
- Repository type: Private
- Authentication: Personal Access Token with repo permissions
Additional context
- The same API endpoints work correctly when called directly with curl using the same authentication token
- The user has admin access to the repository
- The PR exists and has comments visible in the GitHub web interface
- Other gh commands work correctly with the same repository (e.g.,
gh pr list, gh pr view)
This issue affects workflows that depend on programmatically accessing PR comments for automation purposes.
Describe the bug
When using GitHub CLI to fetch PR comments from a private repository that the authenticated user has access to, the commands return '404 Not Found' errors even though the user can access the repository and PR through the web interface.
Steps to reproduce
gh pr view --json number,headRepository(works correctly)gh api /repos/{owner}/{repo}/issues/{pr_number}/commentsgh api /repos/{owner}/{repo}/pulls/{pr_number}/commentsExpected behavior
The commands should return the PR comments in JSON format, similar to how they work for public repositories.
Actual behavior
Both commands return:
Environment
Additional context
gh pr list,gh pr view)This issue affects workflows that depend on programmatically accessing PR comments for automation purposes.