Skip to content

Commit 21e0063

Browse files
refactor: update route path per PR discussion
1 parent 0b55c35 commit 21e0063

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

services/github/github-actions.service.js renamed to services/github/github-workflow-status.service.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ const schema = Joi.object({
1111
.required(),
1212
}).required()
1313

14-
module.exports = class GithubActions extends BaseSvgScrapingService {
14+
const keywords = ['action', 'actions']
15+
16+
module.exports = class GithubWorkflowStatus extends BaseSvgScrapingService {
1517
static get category() {
1618
return 'build'
1719
}
1820

1921
static get route() {
2022
return {
21-
base: 'github/actions',
23+
base: 'github/workflow/status',
2224
pattern: ':user/:repo/:workflow/:branch*',
2325
}
2426
}
2527

2628
static get examples() {
2729
return [
2830
{
29-
title: 'GitHub Actions',
31+
title: 'GitHub Workflow Status',
3032
pattern: ':user/:repo/:workflow',
3133
namedParams: {
3234
user: 'actions',
@@ -37,9 +39,10 @@ module.exports = class GithubActions extends BaseSvgScrapingService {
3739
status: 'passing',
3840
}),
3941
documentation,
42+
keywords,
4043
},
4144
{
42-
title: 'GitHub Actions (branch)',
45+
title: 'GitHub Workflow Status (branch)',
4346
pattern: ':user/:repo/:workflow/:branch',
4447
namedParams: {
4548
user: 'actions',
@@ -51,6 +54,7 @@ module.exports = class GithubActions extends BaseSvgScrapingService {
5154
status: 'passing',
5255
}),
5356
documentation,
57+
keywords,
5458
},
5559
]
5660
}

services/github/github-actions.tester.js renamed to services/github/github-workflow-status.tester.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
'use strict'
22

3+
const Joi = require('@hapi/joi')
34
const { isBuildStatus } = require('../build-status')
45
const t = (module.exports = require('../tester').createServiceTester())
56

7+
const isWorkflowStatus = Joi.alternatives()
8+
.try(isBuildStatus, Joi.equal('no status'))
9+
.required()
10+
611
t.create('nonexistent repo')
712
.get('/badges/shields-fakeness/fake.json')
813
.expectBadge({
@@ -21,12 +26,12 @@ t.create('valid workflow')
2126
.get('/actions/toolkit/Main%20workflow.json')
2227
.expectBadge({
2328
label: 'build',
24-
message: isBuildStatus,
29+
message: isWorkflowStatus,
2530
})
2631

2732
t.create('valid workflow (branch)')
2833
.get('/actions/toolkit/Main%20workflow/master.json')
2934
.expectBadge({
3035
label: 'build',
31-
message: isBuildStatus,
36+
message: isWorkflowStatus,
3237
})

0 commit comments

Comments
 (0)