(commit)
| 173 | } |
| 174 | |
| 175 | async function renderCommitLine(commit) { |
| 176 | let message = ''; |
| 177 | let user = ''; |
| 178 | let pr; |
| 179 | |
| 180 | // commit fields: [0] hash, [1] ISO date, [2] author name, [3] subject (from --pretty format) |
| 181 | let m = commit[3].match(/(.*?) \(#(\d+)\)$/); |
| 182 | |
| 183 | if (m) { |
| 184 | let prId = m[2]; |
| 185 | message = m[1]; |
| 186 | |
| 187 | try { |
| 188 | let res = await octokit.request('GET /repos/adobe/react-spectrum/pulls/{pull}', {pull: prId}); |
| 189 | user = `[@${res.data.user.login}](${res.data.user.html_url})`; |
| 190 | pr = `https://github.com/adobe/react-spectrum/pull/${prId}`; |
| 191 | } catch (e) { |
| 192 | console.warn( |
| 193 | `⚠ Could not fetch PR #${prId} from GitHub (${e.message}) — falling back to git author` |
| 194 | ); |
| 195 | user = commit[2]; |
| 196 | } |
| 197 | } else { |
| 198 | message = commit[3]; |
| 199 | user = commit[2]; |
| 200 | } |
| 201 | |
| 202 | return `* ${message} - ${user}` + (pr ? ` - [PR](${pr})` : ''); |
| 203 | } |
| 204 | |
| 205 | run(); |
| 206 |
nothing calls this directly
no outgoing calls
no test coverage detected