@@ -41,11 +41,11 @@ const SUMMARY_HEADER=`
4141<summary>Failed checks</summary>
4242
4343Issues marked with an :x: are failing checks.
44- `
44+ ` ;
4545
4646const SUMMARY_FOOTER = `
4747</details>
48- `
48+ ` ;
4949
5050async function hideOldSummaries ( { github, owner, repo, issueNumber } ) {
5151 const result = await github . graphql ( GET_COMMENTS_QUERY , { owner, repo, issueNumber } ) ;
@@ -61,17 +61,19 @@ async function hideOldSummaries({ github, owner, repo, issueNumber }) {
6161 }
6262}
6363
64- function getJobUrl ( { context, jobId } ) {
65- return `https://github.com/GeorgeSapkin/openwrt-packages /actions/runs/${ context . runId } /job/${ jobId } ?pr=${ context . issue . number } #${ STEP_ANCHOR } ` ;
64+ function getJobUrl ( { context, jobId } ) {
65+ return `https://github.com/${ context . repo . owner } / ${ context . repo . repo } /actions/runs/${ context . runId } /job/${ jobId } ?pr=${ context . issue . number } #${ STEP_ANCHOR } ` ;
6666}
6767
6868function getSummaryMessage ( { context, jobId, summary } ) {
6969 return `
7070 ${ SUMMARY_HEADER }
71+
7172 ${ summary }
73+
7274 ${ SUMMARY_FOOTER }
7375 For more details, see the [full job log](${ getJobUrl ( { context, jobId } ) } ).
74- `
76+ ` ;
7577}
7678
7779async function processFormalities ( { github, context, jobId, summary } ) {
@@ -80,14 +82,19 @@ async function processFormalities({ github, context, jobId, summary }) {
8082
8183 await hideOldSummaries ( { github, owner, repo, issueNumber } ) ;
8284
85+ summary = summary . trim ( ) ;
86+ if ( summary . length === 0 ) {
87+ return ;
88+ }
89+
8390 console . log ( "Posting new summary comment" ) ;
8491 const body = getSummaryMessage ( { context, jobId, summary } ) ;
8592 return github . rest . issues . createComment ( {
8693 issue_number : issueNumber ,
8794 owner,
8895 repo,
8996 body,
90- } )
97+ } ) ;
9198}
9299
93100module . exports = processFormalities ;
0 commit comments