danger 8.4.1 → 8.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 423862c4ae06fbd90dbc52ae126b171c3af53da1867f6051db5e1e00cd1cb09e
|
|
4
|
+
data.tar.gz: 45d13ff59705d33a756f8a221ef597f8c29f534511a9cd310241d2730b118e59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a1e23473e3012edb47a6860ca50a4e0e12512ade5c2796b79720c71ba049c034060893505a5264df3ee36439ae702dffe1cc9472da4e6357d2cef7ba81e24b8
|
|
7
|
+
data.tar.gz: 4e186a0412277f4d3add84821f39529900c9faec5439ccd62329bc24e6a753c19feafe68208f9ff3b7fe8b12e64ba8b31379b7af5273f24dfa230ec804f12648
|
|
@@ -137,7 +137,7 @@ module Danger
|
|
|
137
137
|
|
|
138
138
|
def client
|
|
139
139
|
scm_provider = find_scm_provider(remote_url)
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
case scm_provider
|
|
142
142
|
when :bitbucket_cloud
|
|
143
143
|
require "danger/request_sources/bitbucket_cloud_api"
|
|
@@ -151,8 +151,15 @@ module Danger
|
|
|
151
151
|
|
|
152
152
|
when :github
|
|
153
153
|
require "octokit"
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
access_token = ENV["DANGER_GITHUB_API_TOKEN"]
|
|
155
|
+
bearer_token = ENV["DANGER_GITHUB_BEARER_TOKEN"]
|
|
156
|
+
if bearer_token && !bearer_token.empty?
|
|
157
|
+
Octokit::Client.new(bearer_token: bearer_token, api_endpoint: api_url)
|
|
158
|
+
elsif access_token && !access_token.empty?
|
|
159
|
+
Octokit::Client.new(access_token: access_token, api_endpoint: api_url)
|
|
160
|
+
else
|
|
161
|
+
raise "No API token given, please provide one using `DANGER_GITHUB_API_TOKEN` or `DANGER_GITHUB_BEARER_TOKEN`"
|
|
162
|
+
end
|
|
156
163
|
else
|
|
157
164
|
raise "SCM provider not supported: #{scm_provider}"
|
|
158
165
|
end
|
|
@@ -17,7 +17,7 @@ module Danger
|
|
|
17
17
|
attr_accessor :pr_json, :issue_json, :support_tokenless_auth, :dismiss_out_of_range_messages
|
|
18
18
|
|
|
19
19
|
def self.env_vars
|
|
20
|
-
["DANGER_GITHUB_API_TOKEN"]
|
|
20
|
+
["DANGER_GITHUB_API_TOKEN", "DANGER_GITHUB_BEARER_TOKEN"]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def self.optional_env_vars
|
|
@@ -30,7 +30,8 @@ module Danger
|
|
|
30
30
|
self.support_tokenless_auth = false
|
|
31
31
|
self.dismiss_out_of_range_messages = false
|
|
32
32
|
|
|
33
|
-
@
|
|
33
|
+
@access_token = @environment["DANGER_GITHUB_API_TOKEN"]
|
|
34
|
+
@bearer_token = @environment["DANGER_GITHUB_BEARER_TOKEN"]
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def get_pr_from_branch(repo_name, branch_name, owner)
|
|
@@ -45,7 +46,7 @@ module Danger
|
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
def validates_as_api_source?
|
|
48
|
-
|
|
49
|
+
valid_bearer_token? || valid_access_token? || self.environment["DANGER_USE_LOCAL_GIT"]
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
def scm
|
|
@@ -72,12 +73,16 @@ module Danger
|
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
def client
|
|
75
|
-
raise "No API token given, please provide one using `DANGER_GITHUB_API_TOKEN`" if
|
|
76
|
+
raise "No API token given, please provide one using `DANGER_GITHUB_API_TOKEN` or `DANGER_GITHUB_BEARER_TOKEN`" if !valid_access_token? && !valid_bearer_token? && !support_tokenless_auth
|
|
76
77
|
@client ||= begin
|
|
77
78
|
Octokit.configure do |config|
|
|
78
79
|
config.connection_options[:ssl] = { verify: verify_ssl }
|
|
79
80
|
end
|
|
80
|
-
|
|
81
|
+
if valid_bearer_token?
|
|
82
|
+
Octokit::Client.new(bearer_token: @bearer_token, auto_paginate: true, api_endpoint: api_url)
|
|
83
|
+
elsif valid_access_token?
|
|
84
|
+
Octokit::Client.new(access_token: @access_token, auto_paginate: true, api_endpoint: api_url)
|
|
85
|
+
end
|
|
81
86
|
end
|
|
82
87
|
end
|
|
83
88
|
|
|
@@ -493,6 +498,14 @@ module Danger
|
|
|
493
498
|
|
|
494
499
|
private
|
|
495
500
|
|
|
501
|
+
def valid_access_token?
|
|
502
|
+
@access_token && !@access_token.empty?
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
def valid_bearer_token?
|
|
506
|
+
@bearer_token && !@bearer_token.empty?
|
|
507
|
+
end
|
|
508
|
+
|
|
496
509
|
def regular_violations_group(warnings: [], errors: [], messages: [], markdowns: [])
|
|
497
510
|
{
|
|
498
511
|
warnings: warnings.reject(&:inline?),
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.4.
|
|
4
|
+
version: 8.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Orta Therox
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2021-10
|
|
12
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: claide
|