use package extension instead of word "package"

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-02-06 09:43:34 +01:00
parent 20ac4cf8cd
commit ef1176ec7d
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
6 changed files with 26 additions and 28 deletions

View File

@ -12,9 +12,9 @@ The problem this solves is posting comments in a PR from multiple builds without
|-|-|-|-|-|-|-|
| :x: | a088572b | [#3](https://google.pl) | 2018-12-21 12:12:55 | ~12 min | `android` | [:page_facing_up: build log](https://google.plconsoleText) |
| :x: | a088572b | [#3](https://google.pl) | 2018-12-21 12:13:18 | ~12 min | `android` | [:page_facing_up: build log](https://google.plconsoleText) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:13:53 | ~12 min | `ios` | [:package: package](https://google.pl) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:13:34 | ~12 min | `ios` | [:package: package](https://google.pl) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:14:44 | ~12 min | `ios` | [:package: package](https://google.pl) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:13:53 | ~12 min | `ios` | [:package: api](https://google.pl) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:13:34 | ~12 min | `android` | [:package: apk](https://google.pl) |
| :heavy_check_mark: | a088572b | [#3](https://google.pl) | 2018-12-21 12:14:44 | ~12 min | `windows` | [:package: exe](https://google.pl) |
---
# API

View File

@ -1,6 +1,6 @@
{
"name": "github-comment-manager",
"version": "0.1.0",
"version": "0.1.1",
"description": "Minimal API for managing GitHub comments for CIclicks.",
"repository": "https://github.com/status-im/github-comment-manager",
"main": "index.js",

View File

@ -14,19 +14,15 @@ const commitHelper = (data, index, options) => {
}
/* turns epoch time to human readable format */
const dateHelper = (data) => {
return new Handlebars.SafeString(
(new Date(data))
.toISOString('utc')
.slice(0, 19)
.replace('T', ' ')
)
}
const dateHelper = (data) => new Handlebars.SafeString(
(new Date(data)).toISOString('utc').slice(0, 19).replace('T', ' ')
)
/* extracts file extension from url */
const fileExt = (data) => new Handlebars.SafeString(data.split('.').pop())
/* remove seconds from duration to make columns equal width */
const shortenDuration = (data) => {
return data.replace(/ [0-9]+ sec$/, '')
}
const shortenDuration = (data) => (data.replace(/ [0-9]+ sec$/, ''))
/* adds archive attribute to builds to mark for folding in template */
const extractArchiveBuilds = (builds) => {
@ -51,6 +47,8 @@ class Comments {
this.owner = owner /* name of user who makes the comments */
/* add helper for formatting dates */
Handlebars.registerHelper('date', dateHelper)
/* add helper extracting file extension */
Handlebars.registerHelper('fileExt', fileExt)
/* add helper for shortening duration field */
Handlebars.registerHelper('shortenDuration', shortenDuration)
/* add helper for checking change in commit */

View File

@ -22,7 +22,7 @@ const buildsTable = `
`.trim()
const buildRow = `
{{#if this.success}}
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:package: package]({{ this.pkg_url }}) |
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:package: {{fileExt this.pkg_url }}]({{ this.pkg_url }}) |
{{else}}
| :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{date this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:page_facing_up: build log]({{ this.url }}consoleText) |
{{/if}}

View File

@ -12,8 +12,8 @@ const COMMENT = `
### Jenkins Builds
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package: package](PKG_URL-1) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package: package](PKG_URL-2) |
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package: ext1](PKG_URL-1.ext1) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package: ext2](PKG_URL-2.ext2) |
`
const COMMENT_FOLDED = `
@ -23,22 +23,22 @@ const COMMENT_FOLDED = `
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package: package](PKG_URL-1) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package: package](PKG_URL-2) |
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package: ext1](PKG_URL-1.ext1) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package: ext2](PKG_URL-2.ext2) |
| :x: | COMMIT-0 | [ID-3](URL-3) | 2018-12-20 08:27:50 | DURATION-3 | \`PLATFORM-3\` | [:page_facing_up: build log](URL-3consoleText) |
| | | | | | | |
| :heavy_check_mark: | COMMIT-1 | [ID-4](URL-4) | 2018-12-20 08:28:47 | DURATION-4 | \`PLATFORM-4\` | [:package: package](PKG_URL-4) |
| :heavy_check_mark: | COMMIT-1 | [ID-5](URL-5) | 2018-12-20 08:29:43 | DURATION-5 | \`PLATFORM-5\` | [:package: package](PKG_URL-5) |
| :heavy_check_mark: | COMMIT-1 | [ID-4](URL-4) | 2018-12-20 08:28:47 | DURATION-4 | \`PLATFORM-4\` | [:package: ext4](PKG_URL-4.ext4) |
| :heavy_check_mark: | COMMIT-1 | [ID-5](URL-5) | 2018-12-20 08:29:43 | DURATION-5 | \`PLATFORM-5\` | [:package: ext5](PKG_URL-5.ext5) |
| :x: | COMMIT-1 | [ID-6](URL-6) | 2018-12-20 08:30:40 | DURATION-6 | \`PLATFORM-6\` | [:page_facing_up: build log](URL-6consoleText) |
| :heavy_check_mark: | COMMIT-1 | [ID-7](URL-7) | 2018-12-20 08:31:37 | DURATION-7 | \`PLATFORM-7\` | [:package: package](PKG_URL-7) |
| :heavy_check_mark: | COMMIT-1 | [ID-7](URL-7) | 2018-12-20 08:31:37 | DURATION-7 | \`PLATFORM-7\` | [:package: ext7](PKG_URL-7.ext7) |
</details>
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-2 | [ID-8](URL-8) | 2018-12-20 08:32:34 | DURATION-8 | \`PLATFORM-8\` | [:package: package](PKG_URL-8) |
| :heavy_check_mark: | COMMIT-2 | [ID-8](URL-8) | 2018-12-20 08:32:34 | DURATION-8 | \`PLATFORM-8\` | [:package: ext8](PKG_URL-8.ext8) |
| :x: | COMMIT-2 | [ID-9](URL-9) | 2018-12-20 08:33:31 | DURATION-9 | \`PLATFORM-9\` | [:page_facing_up: build log](URL-9consoleText) |
| :heavy_check_mark: | COMMIT-2 | [ID-10](URL-10) | 2018-12-20 08:34:27 | DURATION-10 | \`PLATFORM-10\` | [:package: package](PKG_URL-10) |
| :heavy_check_mark: | COMMIT-2 | [ID-11](URL-11) | 2018-12-20 08:35:24 | DURATION-11 | \`PLATFORM-11\` | [:package: package](PKG_URL-11) |
| :heavy_check_mark: | COMMIT-2 | [ID-10](URL-10) | 2018-12-20 08:34:27 | DURATION-10 | \`PLATFORM-10\` | [:package: ext10](PKG_URL-10.ext10) |
| :heavy_check_mark: | COMMIT-2 | [ID-11](URL-11) | 2018-12-20 08:35:24 | DURATION-11 | \`PLATFORM-11\` | [:package: ext11](PKG_URL-11.ext11) |
| | | | | | | |
| :x: | COMMIT-3 | [ID-12](URL-12) | 2018-12-20 08:36:21 | DURATION-12 | \`PLATFORM-12\` | [:page_facing_up: build log](URL-12consoleText) |
`

View File

@ -6,7 +6,7 @@ const BUILD = {
platform: 'PLATFORM-1',
duration: 'DURATION-1',
url: 'https://example.com/some/url/path',
pkg_url: 'https://example.com/some/pkg/path',
pkg_url: 'https://example.com/some/pkg/path.ext',
}
const getBuild = (idx) => ({
@ -16,7 +16,7 @@ const getBuild = (idx) => ({
platform: `PLATFORM-${idx}`,
duration: `DURATION-${idx} 12 sec`,
url: `URL-${idx}`,
pkg_url: `PKG_URL-${idx}`,
pkg_url: `PKG_URL-${idx}.ext${idx}`,
meta: { created: 1545294300000+(idx*56789) },
})