@@ -59,6 +59,18 @@ function getUploadAssetsWorkflowId() {
5959 ] )
6060}
6161
62+ /**
63+ * These lines get printed in an Omicron PR, so any references to commits or
64+ * issues need to be qualified.
65+ */
66+ function linkifyGitLog ( line : string ) : string {
67+ const sha = line . slice ( 2 , 10 )
68+ const rest = line . slice ( 11 ) . replace ( / # \d + / g, ( s ) => 'oxidecomputer/console' + s )
69+ const shaLink = `[${ sha } ](https://github.com/oxidecomputer/console/commit/${ sha } )`
70+
71+ return `* ${ shaLink } ${ rest } `
72+ }
73+
6274// script starts here
6375
6476const args = flags . parse ( Deno . args , {
@@ -108,9 +120,18 @@ if (oldCommit === newCommit) {
108120
109121const commitRange = `${ oldCommit . slice ( 0 , 8 ) } ...${ newCommit . slice ( 0 , 8 ) } `
110122
123+ const commits = run ( 'git' , [ 'log' , '--graph' , '--oneline' , commitRange ] )
124+ // commits are console commits, so they won't auto-link in omicron
125+ const commitsMarkdown = commits . split ( '\n' ) . map ( linkifyGitLog ) . join ( '\n' )
126+
127+ const changesLine = `https://github.com/oxidecomputer/console/compare/${ commitRange } `
128+
111129const branchName = 'bump-console-' + newCommit . slice ( 0 , 8 )
112130const prTitle = 'Bump web console' + ( args . message ? ` (${ args . message } )` : '' )
113- const prBody = `Changes: https://github.com/oxidecomputer/console/compare/${ commitRange } `
131+ const prBody = `${ changesLine } \n\n${ commitsMarkdown } `
132+
133+ // markdown links make the inline preview unreadable, so leave them out
134+ const prBodyPreview = `${ changesLine } \n\n${ commits } `
114135
115136console . log ( `
116137New contents of <omicron>/tools/console_version:
@@ -119,11 +140,12 @@ ${newVersionFile}
119140
120141Branch: ${ branchName }
121142PR title: ${ prTitle }
122- PR body: ${ prBody }
123-
124- Console commits since current pinned version:
125143
126- ${ run ( 'git' , [ 'log' , '--graph' , '--oneline' , '--color=always' , commitRange ] ) } `)
144+ --------
145+ PR body
146+ --------
147+
148+ ${ prBodyPreview } `)
127149
128150if ( args . dryRun || ! confirm ( '\nMake Omicron PR with these changes?' ) ) {
129151 Deno . exit ( )
0 commit comments