diff --git a/src/app.js b/src/app.js index 4c22a5b..ddd596e 100644 --- a/src/app.js +++ b/src/app.js @@ -37,7 +37,7 @@ const App = (ghc) => { router.get('/builds/:pr', async (ctx) => { /* TODO add validation of id parameter */ const builds = await ghc.db.getBuilds(ctx.params.pr) - ctx.body = {status:'ok', builds} + ctx.body = {count: builds.length, builds} }) return app diff --git a/src/template.js b/src/template.js index 72f00e2..c948c67 100644 --- a/src/template.js +++ b/src/template.js @@ -3,10 +3,10 @@ module.exports = ` | :grey_question: | Commit | When | Platform | Build | Duration | Result | |-|-|-|-|-|-|-| {% for b in builds -%} -{% if b.success -%} -| :heavy_check_mark: | {{ b.commit }} | {{ b.when }} | \`{{ b.platform }}\` | [{{ b.pr }}#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:package: {{ b.platform }}]({{ b.pkg_url }}) | +{%- if b.success -%} +| :heavy_check_mark: | {{ b.commit }} | {{ b.meta.created }} | \`{{ b.platform }}\` | [{{ b.pr }}#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:package: {{ b.platform }}]({{ b.pkg_url }}) | {% else -%} -| :x: | {{ b.commit }} | {{ b.when }} | \`{{ b.platform }}\` | [{{ b.pr }}#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:page_facing_up: build log]({{ b.pkg_url }}consoleText) | -{%- endif %} -{%- endfor %} +| :x: | {{ b.commit }} | {{ b.meta.created }} | \`{{ b.platform }}\` | [{{ b.pr }}#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:page_facing_up: build log]({{ b.pkg_url }}consoleText) | +{% endif -%} +{%- endfor -%} `