danger 5.10.3 → 5.11.0
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 +4 -4
- data/lib/danger/ci_source/github_actions.rb +50 -0
- data/lib/danger/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc19a9a709230e8b4432b755dbde508efee5ea0f53c88efce1c0f25a3439004
|
4
|
+
data.tar.gz: c177f25da30fa7e755032b813e0289af9f5b88bd0afd77b3aa2084d0cb8185fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0801eecdb94b04e3ac6ca56e5b4e5be653a619463c7beb120ba731d4c244ed0e03839f350d634c1d9c1008e9c8593ace89500379995b1fff614ab7e5d901acd2'
|
7
|
+
data.tar.gz: 45b6b8333f990cf3582b6b99ab8ad4adc5a9f0bac28dddc0601fa8948f12a8005e3da0c2a5cb014661eeee86288661f6be558cea9ce1c6c9763dffed77082433
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "danger/request_sources/github/github"
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
# ### CI Setup
|
5
|
+
#
|
6
|
+
# You can use `duck8823/actions/danger` Action in your .github/main.workflow.
|
7
|
+
#
|
8
|
+
# ```
|
9
|
+
# action "Danger" {
|
10
|
+
# uses = "duck8823/actions/danger"
|
11
|
+
# }
|
12
|
+
# ```
|
13
|
+
#
|
14
|
+
# ### Token Setup
|
15
|
+
#
|
16
|
+
# Set DANGER_GITHUB_API_TOKEN to secrets, or you can also use GITHUB_TOKEN.
|
17
|
+
#
|
18
|
+
# ```
|
19
|
+
# action "Danger" {
|
20
|
+
# uses = "duck8823/actions/danger"
|
21
|
+
# secrets = ["GITHUB_TOKEN"]
|
22
|
+
# }
|
23
|
+
# ```
|
24
|
+
#
|
25
|
+
class GitHubActions < CI
|
26
|
+
def self.validates_as_ci?(env)
|
27
|
+
env.key? "GITHUB_ACTION"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.validates_as_pr?(env)
|
31
|
+
env["GITHUB_EVENT_NAME"] == "pull_request"
|
32
|
+
end
|
33
|
+
|
34
|
+
def supported_request_sources
|
35
|
+
@supported_request_sources ||= [Danger::RequestSources::GitHub]
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(env)
|
39
|
+
self.repo_slug = env["GITHUB_REPOSITORY"]
|
40
|
+
pull_request_event = JSON.parse(File.read(env["GITHUB_EVENT_PATH"]))
|
41
|
+
self.pull_request_id = pull_request_event['number']
|
42
|
+
self.repo_url = pull_request_event['repository']['clone_url']
|
43
|
+
|
44
|
+
# if environment variable DANGER_GITHUB_API_TOKEN is not set, use env GITHUB_TOKEN
|
45
|
+
if (env.key? "GITHUB_ACTION") && (!env.key? 'DANGER_GITHUB_API_TOKEN')
|
46
|
+
env['DANGER_GITHUB_API_TOKEN'] = env['GITHUB_TOKEN']
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
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: 5.
|
4
|
+
version: 5.11.0
|
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: 2018-12-
|
12
|
+
date: 2018-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- lib/danger/ci_source/codeship.rb
|
191
191
|
- lib/danger/ci_source/dotci.rb
|
192
192
|
- lib/danger/ci_source/drone.rb
|
193
|
+
- lib/danger/ci_source/github_actions.rb
|
193
194
|
- lib/danger/ci_source/gitlab_ci.rb
|
194
195
|
- lib/danger/ci_source/jenkins.rb
|
195
196
|
- lib/danger/ci_source/local_git_repo.rb
|