Skip to content

Commit d933ac3

Browse files
authored
add new fields to query to include additional info (#253)
* add new fields to query to include additional info * handle new case about issues being disabled as well as attaching new data * whatever rubocop
1 parent 689b456 commit d933ac3

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Metrics/CyclomaticComplexity:
3636
Max: 13
3737

3838
Metrics/MethodLength:
39-
Max: 46
39+
Max: 48
4040

4141
Metrics/PerceivedComplexity:
4242
Max: 13

lib/queries/github_repository_label_active_check.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ def self.parse(result)
88
# we should be checking for repository existence before this, but flag it anyway
99
return { reason: 'repository-missing' } if repository.nil?
1010

11+
return { reason: 'issues-disabled' } unless repository.has_issues_enabled
12+
1113
return { reason: 'missing' } if repository.label.nil?
1214

1315
label = repository.label
16+
fork_count = repository.fork_count
17+
1418
count = label.issues.total_count
1519
last_updated = (label.issues.nodes[0].updated_at if count.positive?)
1620

17-
{ reason: 'found', name: label.name, url: label.url, count: count, last_updated: last_updated }
21+
{ reason: 'found', name: label.name, url: label.url, count: count, fork_count: fork_count, last_updated: last_updated }
1822
end
1923

2024
def self.run(project)
@@ -91,6 +95,8 @@ def headers(_context)
9195
label(name: $label) {
9296
name
9397
url
98+
hasIssuesEnabled
99+
forkCount
94100
issues(states: OPEN, first: 1, orderBy: {field: UPDATED_AT, direction: DESC}) {
95101
totalCount
96102
nodes {

0 commit comments

Comments
 (0)