move the list of builds to a separate partial

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-01-15 21:07:25 +01:00
parent ab488cb9dd
commit 080139a2df
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 9 additions and 4 deletions

View File

@ -34,7 +34,8 @@ class Comments {
/* add helper for checking change in commit */ /* add helper for checking change in commit */
Handlebars.registerHelper('commitChanged', commitHelper) Handlebars.registerHelper('commitChanged', commitHelper)
/* setup templating for comments */ /* setup templating for comments */
this.template = Handlebars.compile(template); Handlebars.registerPartial('build', template.build)
this.template = Handlebars.compile(template.main);
} }
async renderComment (pr) { async renderComment (pr) {

View File

@ -1,4 +1,4 @@
module.exports = ` const main = `
### Jenkins Builds ### Jenkins Builds
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result | | :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-| |-|-|-|-|-|-|-|
@ -6,10 +6,14 @@ module.exports = `
{{#commitChanged ../builds @index}} {{#commitChanged ../builds @index}}
| | | | | | | | | | | | | | | |
{{/commitChanged}} {{/commitChanged}}
{{> build }}
{{/each}}
`
const build = `
{{#if this.success}} {{#if this.success}}
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:package: package]({{ this.pkg_url }}) | | :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:package: package]({{ this.pkg_url }}) |
{{else}} {{else}}
| :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:page_facing_up: build log]({{ this.url }}consoleText) | | :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ this.duration }} | \`{{ this.platform }}\` | [:page_facing_up: build log]({{ this.url }}consoleText) |
{{/if}} {{/if}}
{{/each}} `.trim()
` module.exports = { main, build }