@@ -20,41 +20,41 @@ import { IssueCreationOptions } from "../../../spi/issue/IssueCreationOptions";
2020import { DryRunMessage } from "./makeBuildAware" ;
2121
2222/**
23- * React to result of a dry run build to raise a PR or issue
23+ * React to result of a build-aware build to raise a PR or issue.
2424 */
25- export function dryRunBuildListener ( opts : IssueCreationOptions ) : BuildListener {
25+ export function buildAwareBuildListener ( opts : IssueCreationOptions ) : BuildListener {
2626 return async bu => {
2727 const build = bu . build ;
2828 const branch = build . push . branch ;
2929
30- logger . debug ( "Assessing dry run for %j: Commit message=%s " , bu . id , bu . build . commit . message ) ;
30+ logger . debug ( "Assessing build aware build for '%j': '%s' " , bu . id , bu . build . commit . message ) ;
3131 if ( ! bu . build . commit . message . includes ( DryRunMessage ) ) {
32- logger . info ( "Not a dry run commit: %j: Commit message=%s " , bu . id , bu . build . commit . message ) ;
32+ logger . info ( "Not a build aware build: '%j': '%s' " , bu . id , bu . build . commit . message ) ;
3333 return ;
3434 }
3535
3636 const body = bu . build . commit . message . replace ( DryRunMessage , "" ) . trim ( ) + "\n\n[atomist:generated]" ;
3737 const description = body . split ( "\n" ) [ 0 ] ;
3838 switch ( build . status ) {
3939 case "started" :
40- logger . info ( "Tracking dry run build on %j on branch %s, " , bu . id , branch ) ;
40+ logger . info ( "Tracking build aware build on '%j' on branch '%s' " , bu . id , branch ) ;
4141 // Wait for conclusion
4242 break ;
4343
4444 case "passed" :
45- logger . info ( "Raising PR for successful dry run build on %j " , bu . id ) ;
45+ logger . info ( "Raising PR for successful build aware build on '%j' " , bu . id ) ;
4646 const title = description ;
4747 await bu . id . raisePullRequest (
4848 bu . credentials ,
4949 title ,
50- body ,
50+ body . replace ( description , "" ) . trim ( ) ,
5151 branch ,
5252 "master" ) ;
5353 break ;
5454
5555 case "failed" :
5656 case "broken" :
57- logger . info ( "Raising issue for failed dry run build on %j on branch %s ," , bu . id , branch ) ;
57+ logger . info ( "Raising issue for failed build aware build on '%j' on branch '%s' ," , bu . id , branch ) ;
5858 let issueBody = "Details:\n\n" ;
5959 issueBody += ! ! build . buildUrl ? `[Build log](${ build . buildUrl } )` : "No build log available" ;
6060 issueBody += `\n\n[Branch with failure](${ bu . id . url } /tree/${ branch } "Failing branch ${ branch } ")` ;
@@ -65,7 +65,8 @@ export function dryRunBuildListener(opts: IssueCreationOptions): BuildListener {
6565 break ;
6666
6767 default :
68- logger . info ( "Unexpected build status [%s] issue for failed dry run on %j on branch %s," , bu . build . status , bu . id , branch ) ;
68+ logger . info ( "Unexpected build status [%s] issue for failed build aware build on '%j' on branch '%s'" ,
69+ bu . build . status , bu . id , branch ) ;
6970 break ;
7071 }
7172 } ;
0 commit comments