Skip to content

Commit

Permalink
be sneakier about PR numbers in commit messages in bump omicron PR
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Sep 7, 2023
1 parent af6536d commit 4f7d401
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/deno/bump-omicron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ function getUploadAssetsWorkflowId() {
*/
function linkifyGitLog(line: string): string {
const sha = line.slice(2, 10)
const rest = line.slice(11).replace(/#\d+/g, (s) => 'oxidecomputer/console' + s)
let rest = line.slice(11)

// if the test ends with '(#123)', make the number the whole text, otherwise
// it's redundant when it renders in the PR
const endsWithPr = rest.match(/\(#\d+\)$/)
if (endsWithPr) {
rest = endsWithPr[0].replace(/[()]/g, '')
}

rest = rest.replace(/#\d+/g, (s) => 'oxidecomputer/console' + s)

const shaLink = `[${sha}](https://github.com/oxidecomputer/console/commit/${sha})`

return `* ${shaLink} ${rest}`
Expand Down

0 comments on commit 4f7d401

Please sign in to comment.