mirror of
https://github.com/status-im/github-comment-manager.git
synced 2025-02-19 20:58:09 +00:00
change timestmap format to include date
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
06b863cbe1
commit
6bbadb1c96
@ -5,16 +5,21 @@ import template from './template'
|
||||
const PER_PAGE = 100
|
||||
const COMMENT_REGEX = /\#\#\# Jenkins Builds\n/
|
||||
|
||||
/* compares commits of build and previous build */
|
||||
/* loop helper compares commits of build and previous build */
|
||||
const commitHelper = (data, index, options) => {
|
||||
if (index == 0) { return options.inverse(this); }
|
||||
if (data[index].commit !== data[index-1].commit) { return options.fn(this); }
|
||||
return options.inverse(this);
|
||||
}
|
||||
|
||||
/* formats epoch time to human readable output */
|
||||
/* turns epoch time to human readable format */
|
||||
const dateHelper = (data) => {
|
||||
return new Handlebars.SafeString((new Date(data)).toLocaleTimeString('utc'))
|
||||
return new Handlebars.SafeString(
|
||||
(new Date(data))
|
||||
.toISOString('utc')
|
||||
.slice(0, 19)
|
||||
.replace('T', ' ')
|
||||
)
|
||||
}
|
||||
|
||||
class Comments {
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = `
|
||||
### Jenkins Builds
|
||||
| :grey_question: | Commit | :hash: | Finished | Duration | Platform | Result |
|
||||
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|
||||
|-|-|-|-|-|-|-|
|
||||
{{#each builds}}
|
||||
{{#commitChanged ../builds @index}}
|
||||
|
@ -16,6 +16,7 @@ const BUILDS = [
|
||||
duration: 'DURATION-1',
|
||||
url: 'URL-1',
|
||||
pkg_url: 'PKG_URL-1',
|
||||
meta: { created: 1545294393058 },
|
||||
},
|
||||
{
|
||||
id: 'ID-2',
|
||||
@ -25,17 +26,18 @@ const BUILDS = [
|
||||
duration: 'DURATION-2',
|
||||
url: 'URL-2',
|
||||
pkg_url: 'PKG_URL-2',
|
||||
meta: { created: 1545295528896 },
|
||||
},
|
||||
]
|
||||
|
||||
/* expected comment based on given builds */
|
||||
const COMMENT = `
|
||||
### Jenkins Builds
|
||||
| :grey_question: | Commit | :hash: | Finished | Duration | Platform | Result |
|
||||
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|
||||
|-|-|-|-|-|-|-|
|
||||
| :heavy_check_mark: | COMMIT-1 | [ID-1](URL-1) | Invalid Date | DURATION-1 | \`PLATFORM-1\` | [:package: package](PKG_URL-1) |
|
||||
| :heavy_check_mark: | COMMIT-1 | [ID-1](URL-1) | 2018-12-20 08:26:33 | DURATION-1 | \`PLATFORM-1\` | [:package: package](PKG_URL-1) |
|
||||
| | | | | | | |
|
||||
| :x: | COMMIT-2 | [ID-2](URL-2) | Invalid Date | DURATION-2 | \`PLATFORM-2\` | [:page_facing_up: build log](PKG_URL-2consoleText) |
|
||||
| :x: | COMMIT-2 | [ID-2](URL-2) | 2018-12-20 08:45:28 | DURATION-2 | \`PLATFORM-2\` | [:page_facing_up: build log](PKG_URL-2consoleText) |
|
||||
`
|
||||
|
||||
describe('Comments', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user