Add static preview to some [GitHub] services (#2766)

This commit is contained in:
Paul Melnikow
2019-01-15 21:43:35 -05:00
committed by GitHub
parent 678359bdd6
commit 8a10279d95
10 changed files with 422 additions and 97 deletions

View File

@@ -12,6 +12,11 @@ const {
checkErrorResponse: githubCheckErrorResponse,
} = require('./github-helpers')
const commonExampleAttrs = {
keywords: ['activity', 'latest'],
documentation,
}
// This legacy service should be rewritten to use e.g. BaseJsonService.
//
// Tips for rewriting:
@@ -26,6 +31,7 @@ module.exports = class GithubLastCommit extends LegacyService {
static get route() {
return {
base: 'github/last-commit',
pattern: ':user/:repo/:branch*',
}
}
@@ -33,15 +39,32 @@ module.exports = class GithubLastCommit extends LegacyService {
return [
{
title: 'GitHub last commit',
previewUrl: 'google/skia',
keywords: ['GitHub', 'last', 'latest', 'commit'],
documentation,
pattern: ':user/:repo',
namedParams: {
user: 'google',
repo: 'skia',
},
staticPreview: {
label: 'last commit',
message: 'today',
color: 'brightgreen',
},
...commonExampleAttrs,
},
{
title: 'GitHub last commit (branch)',
previewUrl: 'google/skia/infra/config',
keywords: ['GitHub', 'last', 'latest', 'commit'],
documentation,
pattern: ':user/:repo/:branch',
namedParams: {
user: 'google',
repo: 'skia',
branch: 'infra/config',
},
staticPreview: {
label: 'last commit',
message: 'april 2018',
color: 'yellow',
},
...commonExampleAttrs,
},
]
}