mirror of
https://github.com/status-im/github-comment-manager.git
synced 2025-02-23 06:38:08 +00:00
add formatting of meta.created with Date object
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
f2218da7ab
commit
76e9e727ee
@ -9,10 +9,13 @@ class Comments {
|
|||||||
constructor(client, owner, repo, builds) {
|
constructor(client, owner, repo, builds) {
|
||||||
this.gh = client
|
this.gh = client
|
||||||
this.db = builds
|
this.db = builds
|
||||||
this.nj = nunjucks.configure()
|
|
||||||
this.template = template
|
|
||||||
this.repo = repo /* name of repo to query */
|
this.repo = repo /* name of repo to query */
|
||||||
this.owner = owner /* name of user who makes the comments */
|
this.owner = owner /* name of user who makes the comments */
|
||||||
|
/* setup templating for comments */
|
||||||
|
this.template = template
|
||||||
|
this.nj = new nunjucks.Environment()
|
||||||
|
/* add helper for formatting dates */
|
||||||
|
this.nj.addFilter('date', (data) => (new Date(data)).toLocaleTimeString('utc'))
|
||||||
}
|
}
|
||||||
|
|
||||||
async listComments (pr, per_page = PER_PAGE, sort = 'updated', direction = 'desc') {
|
async listComments (pr, per_page = PER_PAGE, sort = 'updated', direction = 'desc') {
|
||||||
|
@ -4,9 +4,9 @@ module.exports = `
|
|||||||
|-|-|-|-|-|-|-|
|
|-|-|-|-|-|-|-|
|
||||||
{% for b in builds -%}
|
{% for b in builds -%}
|
||||||
{%- if b.success -%}
|
{%- 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 }}) |
|
| :heavy_check_mark: | {{ b.commit }} | {{ b.meta.created | date }} | \`{{ b.platform }}\` | [#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:package: {{ b.platform }}]({{ b.pkg_url }}) |
|
||||||
{% else -%}
|
{% else -%}
|
||||||
| :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) |
|
| :x: | {{ b.commit }} | {{ b.meta.created | date }} | \`{{ b.platform }}\` | [#{{ b.id }}]({{ b.url }}) | {{ b.duration }} | [:page_facing_up: build log]({{ b.pkg_url }}consoleText) |
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user