* List all comments on a PR: issue comments + PR review (inline) comments. * * @returns {Promise<{issueComments:any[], reviewComments:any[], all:any[]}>}
(number, { useCache = true } = {})
| 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. |
no test coverage detected