Skip to content

Commit 427b24c

Browse files
authored
Update description of GitHub commit status badge (#10198)
* [GitHub] update description of commit status badge * fix typo * Add pull request check * regex to english
1 parent e43cb0c commit 427b24c

File tree

2 files changed

+65
-23
lines changed

2 files changed

+65
-23
lines changed

Diff for: services/github/github-checks-status.service.js

+48-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import Joi from 'joi'
2-
import { pathParams } from '../index.js'
2+
import { pathParam } from '../index.js'
33
import { isBuildStatus, renderBuildStatusBadge } from '../build-status.js'
44
import { GithubAuthV3Service } from './github-auth-service.js'
5-
import { documentation, httpErrorsFor } from './github-helpers.js'
5+
import {
6+
documentation as commonDocumentation,
7+
httpErrorsFor,
8+
} from './github-helpers.js'
9+
10+
const description = `
11+
Displays the status of a tag, commit, or branch, as reported by the Commit Status API.
12+
Nowadays, GitHub Actions and many third party integrations report state via the
13+
Checks API. If this badge does not show expected values, please try out our
14+
corresponding Check Runs badge instead. You can read more about status checks in
15+
the [GitHub documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
16+
17+
${commonDocumentation}
18+
`
619

720
const schema = Joi.object({
821
state: isBuildStatus,
@@ -16,24 +29,40 @@ export default class GithubChecksStatus extends GithubAuthV3Service {
1629
}
1730

1831
static openApi = {
19-
'/github/checks-status/{user}/{repo}/{ref}': {
32+
'/github/checks-status/{user}/{repo}/{branch}': {
33+
get: {
34+
summary: 'GitHub branch status',
35+
description,
36+
parameters: [
37+
pathParam({ name: 'user', example: 'badges' }),
38+
pathParam({ name: 'repo', example: 'shields' }),
39+
pathParam({ name: 'branch', example: 'master' }),
40+
],
41+
},
42+
},
43+
'/github/checks-status/{user}/{repo}/{commit}': {
44+
get: {
45+
summary: 'GitHub commit status',
46+
description,
47+
parameters: [
48+
pathParam({ name: 'user', example: 'badges' }),
49+
pathParam({ name: 'repo', example: 'shields' }),
50+
pathParam({
51+
name: 'commit',
52+
example: '91b108d4b7359b2f8794a4614c11cb1157dc9fff',
53+
}),
54+
],
55+
},
56+
},
57+
'/github/checks-status/{user}/{repo}/{tag}': {
2058
get: {
21-
summary: 'GitHub tag checks state',
22-
description: documentation,
23-
parameters: pathParams(
24-
{
25-
name: 'user',
26-
example: 'badges',
27-
},
28-
{
29-
name: 'repo',
30-
example: 'shields',
31-
},
32-
{
33-
name: 'ref',
34-
example: '3.3.0',
35-
},
36-
),
59+
summary: 'GitHub tag status',
60+
description,
61+
parameters: [
62+
pathParam({ name: 'user', example: 'badges' }),
63+
pathParam({ name: 'repo', example: 'shields' }),
64+
pathParam({ name: 'tag', example: '3.3.0' }),
65+
],
3766
},
3867
},
3968
}

Diff for: services/github/github-pull-request-check-state.service.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@ import countBy from 'lodash.countby'
33
import { pathParams } from '../index.js'
44
import { GithubAuthV3Service } from './github-auth-service.js'
55
import { fetchIssue } from './github-common-fetch.js'
6-
import { documentation, httpErrorsFor } from './github-helpers.js'
6+
import {
7+
documentation as commonDocumentation,
8+
httpErrorsFor,
9+
} from './github-helpers.js'
10+
11+
const description = `
12+
Displays the status of a pull request, as reported by the Commit Status API.
13+
Nowadays, GitHub Actions and many third party integrations report state via the
14+
Checks API. If this badge does not show expected values, please try out our
15+
corresponding Check Runs badge instead. You can read more about status checks in
16+
the [GitHub documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
17+
18+
${commonDocumentation}
19+
`
720

821
const schema = Joi.object({
922
state: Joi.equal('failure', 'pending', 'success').required(),
@@ -26,8 +39,8 @@ export default class GithubPullRequestCheckState extends GithubAuthV3Service {
2639
static openApi = {
2740
'/github/status/s/pulls/{user}/{repo}/{number}': {
2841
get: {
29-
summary: 'GitHub pull request check state',
30-
description: documentation,
42+
summary: 'GitHub pull request status',
43+
description,
3144
parameters: pathParams(
3245
{
3346
name: 'user',
@@ -47,7 +60,7 @@ export default class GithubPullRequestCheckState extends GithubAuthV3Service {
4760
'/github/status/contexts/pulls/{user}/{repo}/{number}': {
4861
get: {
4962
summary: 'GitHub pull request check contexts',
50-
description: documentation,
63+
description,
5164
parameters: pathParams(
5265
{
5366
name: 'user',

0 commit comments

Comments
 (0)