cloud-platform-repository-checker 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +15 -0
- data/bin/cloud-platform-repository-checker +3 -5
- data/lib/repository_lister.rb +1 -1
- data/lib/repository_report.rb +3 -3
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b61c06a632987b8c366c692718d701b86639c4c60403f9a7174f7b9a31c6bb6
|
4
|
+
data.tar.gz: c19876ffccb7e82476fb50ed4bd6bac97881d1c6fc4463a068d9c190b264394f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 124e8fc55a5532b7f13c1bfaeaf2dc3b2d316b66474d481a772604d6766770bf992c1ad74a8bf19b115bd797bf5c8b7f1a864b2af8c6a4d92d9ad24c1ea714d1
|
7
|
+
data.tar.gz: 64048556144bdb822d527c0a28b7e5464ec2eed5db1befbe243de1300276a1fc42a917af3ddd84998ffae274ecba2ac8bf28dfda18bdcdaa0b9afcb49ab7e8a2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,6 +5,7 @@ GEM
|
|
5
5
|
public_suffix (>= 2.0.2, < 5.0)
|
6
6
|
byebug (11.1.3)
|
7
7
|
coderay (1.1.2)
|
8
|
+
diff-lcs (1.3)
|
8
9
|
faraday (1.0.1)
|
9
10
|
multipart-post (>= 1.2, < 3)
|
10
11
|
method_source (1.0.0)
|
@@ -19,6 +20,19 @@ GEM
|
|
19
20
|
byebug (~> 11.0)
|
20
21
|
pry (~> 0.13.0)
|
21
22
|
public_suffix (4.0.5)
|
23
|
+
rspec (3.9.0)
|
24
|
+
rspec-core (~> 3.9.0)
|
25
|
+
rspec-expectations (~> 3.9.0)
|
26
|
+
rspec-mocks (~> 3.9.0)
|
27
|
+
rspec-core (3.9.2)
|
28
|
+
rspec-support (~> 3.9.3)
|
29
|
+
rspec-expectations (3.9.2)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-mocks (3.9.1)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-support (3.9.3)
|
22
36
|
sawyer (0.8.2)
|
23
37
|
addressable (>= 2.3.5)
|
24
38
|
faraday (> 0.8, < 2.0)
|
@@ -29,6 +43,7 @@ PLATFORMS
|
|
29
43
|
DEPENDENCIES
|
30
44
|
octokit
|
31
45
|
pry-byebug
|
46
|
+
rspec
|
32
47
|
|
33
48
|
BUNDLED WITH
|
34
49
|
2.1.2
|
@@ -5,16 +5,14 @@
|
|
5
5
|
# do/don't comply with our team-wide standards for how github repositories
|
6
6
|
# should be configured.
|
7
7
|
|
8
|
-
require "bundler/setup"
|
9
8
|
require "json"
|
10
9
|
require "net/http"
|
11
10
|
require "uri"
|
12
11
|
require "octokit"
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
require File.join(libdir, "repository_report")
|
13
|
+
require_relative "../lib/github_graph_ql_client"
|
14
|
+
require_relative "../lib/repository_lister"
|
15
|
+
require_relative "../lib/repository_report"
|
18
16
|
|
19
17
|
############################################################
|
20
18
|
|
data/lib/repository_lister.rb
CHANGED
@@ -12,7 +12,7 @@ class RepositoryLister < GithubGraphQlClient
|
|
12
12
|
# Returns a list of repository names which match `regexp`
|
13
13
|
def repository_names
|
14
14
|
list_repos
|
15
|
-
.
|
15
|
+
.select { |repo| repo["name"] =~ regexp }
|
16
16
|
.map { |repo| repo["name"] }
|
17
17
|
end
|
18
18
|
|
data/lib/repository_report.rb
CHANGED
@@ -101,8 +101,8 @@ class RepositoryReport < GithubGraphQlClient
|
|
101
101
|
def is_team_admin?
|
102
102
|
client = Octokit::Client.new(access_token: github_token)
|
103
103
|
|
104
|
-
client.repo_teams([organization, repo_name].join("/")).
|
105
|
-
|
104
|
+
client.repo_teams([organization, repo_name].join("/")).select do |t|
|
105
|
+
t[:name] == team && t[:permission] == ADMIN
|
106
106
|
end.any?
|
107
107
|
rescue Octokit::NotFound
|
108
108
|
# This happens if our token does not have permission to view repo settings
|
@@ -117,7 +117,7 @@ class RepositoryReport < GithubGraphQlClient
|
|
117
117
|
requiring_branch_protection_rules do |rules|
|
118
118
|
|
119
119
|
rules
|
120
|
-
.
|
120
|
+
.select { |edge| edge.dig("node", "pattern") == MASTER }
|
121
121
|
.any?
|
122
122
|
end
|
123
123
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud-platform-repository-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Salgado
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
12
|
-
dependencies:
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4'
|
13
27
|
description:
|
14
28
|
email: platforms@digital.justice.gov.uk
|
15
29
|
executables:
|
@@ -28,7 +42,8 @@ files:
|
|
28
42
|
- lib/repository_lister.rb
|
29
43
|
- lib/repository_report.rb
|
30
44
|
homepage: https://github.com/ministryofjustice/cloud-platform
|
31
|
-
licenses:
|
45
|
+
licenses:
|
46
|
+
- MIT
|
32
47
|
metadata: {}
|
33
48
|
post_install_message:
|
34
49
|
rdoc_options:
|