• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badges / shields / 45774165149

22 Nov 2026 09:43PM UTC coverage: 79.735% (-18.4%) from 98.17%
45774165149

push

github

web-flow
[Endpoint] Support message override and position it after label in API docs (#12235)

* [Endpoint] Support message override and position it after label in API docs

* Preserve error message when a message override is provided

3371 of 3616 branches covered (93.22%)

43 of 53 new or added lines in 3 files covered. (81.13%)

9589 existing lines in 490 files now uncovered.

41514 of 52065 relevant lines covered (79.73%)

51.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.44
/services/github/github-commits-difference.service.js
1
import Joi from 'joi'
2 ✔
2
import { pathParam, queryParam } from '../index.js'
2 ✔
3
import { metric } from '../text-formatters.js'
2 ✔
4
import { nonNegativeInteger } from '../validators.js'
2 ✔
5
import { GithubAuthV3Service } from './github-auth-service.js'
2 ✔
6
import { documentation, httpErrorsFor } from './github-helpers.js'
2 ✔
7

2 ✔
8
const schema = Joi.object({ total_commits: nonNegativeInteger }).required()
2 ✔
9

2 ✔
10
const queryParamSchema = Joi.object({
2 ✔
11
  base: Joi.string().required(),
2 ✔
12
  head: Joi.string().required(),
2 ✔
13
}).required()
2 ✔
14

2 ✔
15
export default class GithubCommitsDifference extends GithubAuthV3Service {
2 ✔
16
  static category = 'activity'
2 ✔
17
  static route = {
2 ✔
18
    base: 'github/commits-difference',
2 ✔
19
    pattern: ':user/:repo',
2 ✔
20
    queryParamSchema,
2 ✔
21
  }
2 ✔
22

2 ✔
23
  static openApi = {
2 ✔
24
    '/github/commits-difference/{user}/{repo}': {
2 ✔
25
      get: {
2 ✔
26
        summary: 'GitHub commits difference between two branches/tags/commits',
2 ✔
27
        description: documentation,
2 ✔
28
        parameters: [
2 ✔
29
          pathParam({ name: 'user', example: 'microsoft' }),
2 ✔
30
          pathParam({ name: 'repo', example: 'vscode' }),
2 ✔
31
          queryParam({ name: 'base', example: '1.60.0', required: true }),
2 ✔
32
          queryParam({ name: 'head', example: '82f2db7', required: true }),
2 ✔
33
        ],
2 ✔
34
      },
2 ✔
35
    },
2 ✔
36
  }
2 ✔
37

2 ✔
38
  static defaultBadgeData = { label: 'commits difference' }
2 ✔
39

2 ✔
40
  static render({ commitCount }) {
2 ✔
UNCOV
41
    return {
×
UNCOV
42
      message: metric(commitCount),
×
UNCOV
43
      color: 'blue',
×
UNCOV
44
    }
×
UNCOV
45
  }
×
46

2 ✔
47
  async handle({ user, repo }, { base, head }) {
2 ✔
UNCOV
48
    const notFoundMessage = 'could not establish commit difference between refs'
×
UNCOV
49
    const { total_commits: commitCount } = await this._requestJson({
×
UNCOV
50
      schema,
×
UNCOV
51
      url: `/repos/${user}/${repo}/compare/${base}...${head}`,
×
UNCOV
52
      httpErrors: httpErrorsFor(notFoundMessage),
×
UNCOV
53
    })
×
UNCOV
54

×
UNCOV
55
    return this.constructor.render({ commitCount })
×
UNCOV
56
  }
×
57
}
2 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc