Skip to content

ghpr comment list

ghpr comment list - list comment threads on a pull request

Terminal window
ghpr comment list <pr> [options]

List all review comment threads on a pull request. By default, shows all threads; use --unresolved to filter to only unresolved threads. Supports multiple output formats and can write each thread to a separate file for batch processing.

ArgumentRequiredDescription
<pr>YesPull request number
OptionDefaultDescription
-t, --token <token>-GitHub personal access token
-r, --repo <owner/repo>-Repository in owner/repo format
--unresolvedfalseShow only unresolved threads
-f, --format <format>textOutput format: text, json, markdown
--write-each <directory>-Write each thread to a separate JSON file
CodeMeaning
0Success
3Error (API error, auth error, PR not found)

Each thread includes:

  • Thread ID - PRRT_ prefixed ID for use with comment resolve
  • Comment ID - Numeric ID for use with comment reply
  • Author - GitHub username of the commenter
  • Body - Comment text
  • Resolution status - Whether the thread is resolved
  • Outdated flag - Whether the comment is on outdated code
  • File path and line - Location in the code (if applicable)

When using --write-each:

  • Creates the directory if it doesn’t exist
  • Generates one JSON file per thread: {commentId}.json
  • Files contain full thread data including all metadata
  • Will not overwrite existing files
  • Only writes threads that have comments
  • Incompatible with --format json or --format markdown
Terminal window
ghpr comment list 123
Terminal window
ghpr comment list 123 --unresolved
Terminal window
ghpr comment list 123 --format json
Terminal window
ghpr comment list 123 -f markdown
Terminal window
ghpr comment list 123 --unresolved --write-each ./review-threads
Terminal window
ghpr comment list 123 --unresolved --format json | jq -r '.[].threadId'
Terminal window
ghpr comment list 123 --unresolved --write-each ./review-threads
for file in ./review-threads/*.json; do
THREAD_ID=$(jq -r '.encodedThreadId' "$file")
COMMENT_ID=$(jq -r '.comments[0].databaseId' "$file")
# Process each comment...
ghpr comment reply 123 $COMMENT_ID "Fixed!"
ghpr comment resolve 123 $THREAD_ID
done