• 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

51.41
/services/github/github-issues.service.js
1
import gql from 'graphql-tag'
2 ✔
2
import Joi from 'joi'
2 ✔
3
import { pathParams } from '../index.js'
2 ✔
4
import { metric } from '../text-formatters.js'
2 ✔
5
import { nonNegativeInteger } from '../validators.js'
2 ✔
6
import { GithubAuthV4Service } from './github-auth-service.js'
2 ✔
7
import { documentation, transformErrors } from './github-helpers.js'
2 ✔
8

2 ✔
9
const issueCountSchema = Joi.object({
2 ✔
10
  data: Joi.object({
2 ✔
11
    repository: Joi.object({
2 ✔
12
      issues: Joi.object({
2 ✔
13
        totalCount: nonNegativeInteger,
2 ✔
14
      }).required(),
2 ✔
15
    }).required(),
2 ✔
16
  }).required(),
2 ✔
17
}).required()
2 ✔
18

2 ✔
19
const isClosedVariant = {
2 ✔
20
  'issues-closed': true,
2 ✔
21
  'issues-closed-raw': true,
2 ✔
22
}
2 ✔
23

2 ✔
24
export default class GithubIssues extends GithubAuthV4Service {
2 ✔
25
  static category = 'issue-tracking'
2 ✔
26
  static route = {
2 ✔
27
    base: 'github',
2 ✔
28
    pattern:
2 ✔
29
      ':variant(issues|issues-raw|issues-closed|issues-closed-raw)/:user/:repo/:label*',
2 ✔
30
  }
2 ✔
31

2 ✔
32
  static openApi = {
2 ✔
33
    '/github/{variant}/{user}/{repo}': {
2 ✔
34
      get: {
2 ✔
35
        summary: 'GitHub Issues',
2 ✔
36
        description: documentation,
2 ✔
37
        parameters: pathParams(
2 ✔
38
          {
2 ✔
39
            name: 'variant',
2 ✔
40
            example: 'issues',
2 ✔
41
            schema: { type: 'string', enum: this.getEnum('variant') },
2 ✔
42
          },
2 ✔
43
          { name: 'user', example: 'badges' },
2 ✔
44
          { name: 'repo', example: 'shields' },
2 ✔
45
        ),
2 ✔
46
      },
2 ✔
47
    },
2 ✔
48
    '/github/{variant}/{user}/{repo}/{label}': {
2 ✔
49
      get: {
2 ✔
50
        summary: 'GitHub Issues by label',
2 ✔
51
        description: documentation,
2 ✔
52
        parameters: pathParams(
2 ✔
53
          {
2 ✔
54
            name: 'variant',
2 ✔
55
            example: 'issues',
2 ✔
56
            schema: { type: 'string', enum: this.getEnum('variant') },
2 ✔
57
          },
2 ✔
58
          { name: 'user', example: 'badges' },
2 ✔
59
          { name: 'repo', example: 'shields' },
2 ✔
60
          { name: 'label', example: 'service-badge' },
2 ✔
61
        ),
2 ✔
62
      },
2 ✔
63
    },
2 ✔
64
  }
2 ✔
65

2 ✔
66
  static defaultBadgeData = { label: 'issues', color: 'informational' }
2 ✔
67

2 ✔
68
  static render({ isClosed, issueCount, raw, label }) {
2 ✔
69
    const state = isClosed ? 'closed' : 'open'
×
70

×
71
    let labelPrefix = ''
×
72
    let messageSuffix = ''
×
73
    if (raw) {
×
74
      labelPrefix = `${state} `
×
75
    } else {
×
76
      messageSuffix = state
×
77
    }
×
78

×
79
    const isGhLabelMultiWord = label && label.includes(' ')
×
80
    const labelText = label
×
81
      ? `${isGhLabelMultiWord ? `"${label}"` : label} `
×
82
      : ''
×
83
    return {
×
84
      label: `${labelPrefix}${labelText}issues`,
×
85
      message: `${metric(issueCount)}${
×
86
        messageSuffix ? ' ' : ''
×
87
      }${messageSuffix}`,
×
88
      color: issueCount > 0 ? 'yellow' : 'brightgreen',
×
89
    }
×
90
  }
×
91

2 ✔
92
  async fetch({ isClosed, user, repo, label }) {
2 ✔
93
    const {
×
94
      data: {
×
95
        repository: {
×
96
          issues: { totalCount },
×
97
        },
×
98
      },
×
99
    } = await this._requestGraphql({
×
100
      query: gql`
×
101
        query (
×
102
          $user: String!
×
103
          $repo: String!
×
104
          $states: [IssueState!]
×
105
          $labels: [String!]
×
106
        ) {
×
107
          repository(owner: $user, name: $repo) {
×
108
            issues(states: $states, labels: $labels) {
×
109
              totalCount
×
110
            }
×
111
          }
×
112
        }
×
113
      `,
×
114
      variables: {
×
115
        user,
×
116
        repo,
×
117
        labels: label ? [label] : undefined,
×
118
        states: isClosed ? ['CLOSED'] : ['OPEN'],
×
119
      },
×
120
      schema: issueCountSchema,
×
121
      transformErrors,
×
122
    })
×
123
    return { issueCount: totalCount }
×
124
  }
×
125

2 ✔
126
  async handle({ variant, user, repo, label }) {
2 ✔
127
    const raw = variant.endsWith('-raw')
×
128
    const isClosed = isClosedVariant[variant]
×
129
    const { issueCount } = await this.fetch({
×
130
      isClosed,
×
131
      user,
×
132
      repo,
×
133
      label,
×
134
    })
×
135
    return this.constructor.render({
×
136
      isClosed,
×
137
      issueCount,
×
138
      raw,
×
139
      label,
×
140
    })
×
141
  }
×
142
}
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