MCPcopy Create free account
hub / github.com/Martian-Engineering/pr-sheriff / listPRComments

Method listPRComments

src/github/github_fetch.mjs:133–151  ·  view source on GitHub ↗

* List all comments on a PR: issue comments + PR review (inline) comments. * * @returns {Promise<{issueComments:any[], reviewComments:any[], all:any[]}>}

(number, { useCache = true } = {})

Source from the content-addressed store, hash-verified

131 * @returns {Promise<{issueComments:any[], reviewComments:any[], all:any[]}>}
132 */
133 async listPRComments(number, { useCache = true } = {}) {
134 const issueComments = await this.#restPaginateArray({
135 endpoint: `/repos/${this.owner}/${this.name}/issues/${number}/comments`,
136 useCache,
137 });
138
139 const reviewComments = await this.#restPaginateArray({
140 endpoint: `/repos/${this.owner}/${this.name}/pulls/${number}/comments`,
141 useCache,
142 });
143
144 const all = [...issueComments, ...reviewComments].sort((a, b) => {
145 const ta = a.created_at || a.createdAt || '';
146 const tb = b.created_at || b.createdAt || '';
147 return ta.localeCompare(tb);
148 });
149
150 return { issueComments, reviewComments, all };
151 }
152
153 /**
154 * Fetch issue timeline events, including cross-references and "closed by" data.

Callers 3

analyzePrFunction · 0.95
fetchPRWithCommentsFunction · 0.80

Calls 1

#restPaginateArrayMethod · 0.95

Tested by

no test coverage detected