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

badges / shields / 39217188618

18 Oct 2026 11:42PM UTC coverage: 79.763% (-18.4%) from 98.173%
39217188618

push

github

web-flow
Update simple-icons to 16.35.0 (#12233)

Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>

3358 of 3601 branches covered (93.25%)

41381 of 51880 relevant lines covered (79.76%)

50.71 hits per line

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

60.24
/services/github/github-commit-status.service.js
1
import Joi from 'joi'
2 ✔
2
import { NotFound, InvalidParameter, pathParams } from '../index.js'
2 ✔
3
import { GithubAuthV3Service } from './github-auth-service.js'
2 ✔
4
import { documentation, httpErrorsFor } from './github-helpers.js'
2 ✔
5

2 ✔
6
const schema = Joi.object({
2 ✔
7
  // https://stackoverflow.com/a/23969867/893113
2 ✔
8
  status: Joi.equal('identical', 'ahead', 'behind', 'diverged'),
2 ✔
9
}).required()
2 ✔
10

2 ✔
11
export default class GithubCommitStatus extends GithubAuthV3Service {
2 ✔
12
  static category = 'issue-tracking'
2 ✔
13
  static route = {
2 ✔
14
    base: 'github/commit-status',
2 ✔
15
    pattern: ':user/:repo/:branch/:commit',
2 ✔
16
  }
2 ✔
17

2 ✔
18
  static openApi = {
2 ✔
19
    '/github/commit-status/{user}/{repo}/{branch}/{commit}': {
2 ✔
20
      get: {
2 ✔
21
        summary: 'GitHub commit merge status',
2 ✔
22
        description: documentation,
2 ✔
23
        parameters: pathParams(
2 ✔
24
          {
2 ✔
25
            name: 'user',
2 ✔
26
            example: 'badges',
2 ✔
27
          },
2 ✔
28
          {
2 ✔
29
            name: 'repo',
2 ✔
30
            example: 'shields',
2 ✔
31
          },
2 ✔
32
          {
2 ✔
33
            name: 'branch',
2 ✔
34
            example: 'master',
2 ✔
35
          },
2 ✔
36
          {
2 ✔
37
            name: 'commit',
2 ✔
38
            example: '5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c',
2 ✔
39
          },
2 ✔
40
        ),
2 ✔
41
      },
2 ✔
42
    },
2 ✔
43
  }
2 ✔
44

2 ✔
45
  static defaultBadgeData = { label: 'commit status' }
2 ✔
46

2 ✔
47
  static render({ isInBranch, branch }) {
2 ✔
48
    if (isInBranch) {
×
49
      return {
×
50
        message: `in ${branch}`,
×
51
        color: 'brightgreen',
×
52
      }
×
53
    } else {
×
54
      // status: ahead or diverged
×
55
      return {
×
56
        message: `not in ${branch}`,
×
57
        color: 'yellow',
×
58
      }
×
59
    }
×
60
  }
×
61

2 ✔
62
  async handle({ user, repo, branch, commit }) {
2 ✔
63
    let status
×
64
    try {
×
65
      ;({ status } = await this._requestJson({
×
66
        url: `/repos/${user}/${repo}/compare/${branch}...${commit}`,
×
67
        httpErrors: httpErrorsFor('commit or branch not found'),
×
68
        schema,
×
69
      }))
×
70
    } catch (e) {
×
71
      if (e instanceof NotFound) {
×
72
        const { message } = this._parseJson(e.buffer)
×
73
        if (message && message.startsWith('No common ancestor between')) {
×
74
          throw new InvalidParameter({ prettyMessage: 'no common ancestor' })
×
75
        }
×
76
      }
×
77
      throw e
×
78
    }
×
79

×
80
    const isInBranch = status === 'identical' || status === 'behind'
×
81
    return this.constructor.render({ isInBranch, branch })
×
82
  }
×
83
}
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