danger 8.1.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ac1ecdfec8029d0fee2f4d6e0b63e975c56f1ced271f24fd8cf094f3e7e647
4
- data.tar.gz: 65ef72507496b5c6d9d34da8473d5ba6006eba4338d84618a22bd95dd928b115
3
+ metadata.gz: a23a15079e019e675afdc325babf115a1a6f38ddbd06a5ba11dd93243ea1dfa0
4
+ data.tar.gz: 380335b8eb423be1096f3b25b3f2602d24d7288b70deb69e8b9991e6dcf09d16
5
5
  SHA512:
6
- metadata.gz: 8717fee5c49cc4cb0835a7ce4d68755a3981f2e4e18529da14c49a7433b5a250a16097930b0ad342fbed6b0d020219b79795cb46da22b871f1d69b4aaaf3484e
7
- data.tar.gz: 0b128cb7f4b2f6749a6e1f5c58dce9c17bf992f71660e86b3771f5b3797e1165fe4187d58cfb9eb4f343314ef4035c5fbc04936abaf2af32389c9a0522809887
6
+ metadata.gz: 2d68ba968f860e6b4631536548d23279677645d20e7cb5d9567c73222a87128c027664e72f176bca01a31adbbbc2b8f123f5f20997e005a428cc2321e979d023
7
+ data.tar.gz: 10ab5f0cb6c3810e0f4520724854a3a8e3e4aeef35c252ed7a3ac729a2407c73df382a6cb98b1682170efd215bc495a11a312fa1d47f5d1b546632bd415b8d0f
@@ -0,0 +1,61 @@
1
+ require "git"
2
+ require "danger/request_sources/local_only"
3
+
4
+ module Danger
5
+ # Concourse CI Integration
6
+ #
7
+ # https://concourse-ci.org/
8
+ #
9
+ # ### CI Setup
10
+ #
11
+ # With Concourse, you run the docker images yourself, so you will want to add `yarn danger ci` within one of your build jobs.
12
+ #
13
+ # ``` shell
14
+ # build:
15
+ # image: golang
16
+ # commands:
17
+ # - ...
18
+ # - yarn danger ci
19
+ # ```
20
+ #
21
+ # ### Environment Variable Setup
22
+ #
23
+ # As this is self-hosted, you will need to add the `CONCOURSE` environment variable `export CONCOURSE=true` to your build environment,
24
+ # as well as setting environment variables for `PULL_REQUEST_ID` and `REPO_SLUG`. Assuming you are using the github pull request resource
25
+ # https://github.com/jtarchie/github-pullrequest-resource the id of the PR can be accessed from `git config --get pullrequest.id`.
26
+ #
27
+ # ### Token Setup
28
+ #
29
+ # Once again as this is self-hosted, you will need to add `DANGER_GITHUB_API_TOKEN` environment variable to the build environment.
30
+ # The suggested method of storing the token is within the vault - https://concourse-ci.org/creds.html
31
+
32
+ class Concourse < CI
33
+ def self.validates_as_ci?(env)
34
+ env.key? "CONCOURSE"
35
+ end
36
+
37
+ def self.validates_as_pr?(env)
38
+ exists = ["PULL_REQUEST_ID", "REPO_SLUG"].all? { |x| env[x] && !env[x].empty? }
39
+ exists && env["PULL_REQUEST_ID"].to_i > 0
40
+ end
41
+
42
+ def supported_request_sources
43
+ @supported_request_sources ||= [
44
+ Danger::RequestSources::GitHub,
45
+ Danger::RequestSources::GitLab,
46
+ Danger::RequestSources::BitbucketServer,
47
+ Danger::RequestSources::BitbucketCloud
48
+ ]
49
+ end
50
+
51
+ def initialize(env)
52
+ self.repo_slug = env["REPO_SLUG"]
53
+
54
+ if env["PULL_REQUEST_ID"].to_i > 0
55
+ self.pull_request_id = env["PULL_REQUEST_ID"]
56
+ end
57
+ self.repo_url = GitRepo.new.origins
58
+ end
59
+
60
+ end
61
+ end
@@ -21,7 +21,8 @@ module Danger
21
21
  end
22
22
 
23
23
  def self.validates_as_pr?(env)
24
- env["GITHUB_EVENT_NAME"] == "pull_request"
24
+ value = env["GITHUB_EVENT_NAME"]
25
+ value == "pull_request" || value == "pull_request_target"
25
26
  end
26
27
 
27
28
  def supported_request_sources
@@ -206,10 +206,10 @@ module Danger
206
206
  markdowns: markdowns
207
207
  )
208
208
 
209
- rest_inline_violations = submit_inline_comments!({
209
+ rest_inline_violations = submit_inline_comments!(**{
210
210
  danger_id: danger_id,
211
211
  previous_violations: previous_violations
212
- }.merge(**inline_violations))
212
+ }.merge(inline_violations))
213
213
 
214
214
  main_violations = merge_violations(
215
215
  regular_violations, rest_inline_violations
@@ -224,11 +224,11 @@ module Danger
224
224
 
225
225
  # If there are still violations to show
226
226
  if main_violations_sum.any?
227
- body = generate_comment({
227
+ body = generate_comment(**{
228
228
  template: "gitlab",
229
229
  danger_id: danger_id,
230
230
  previous_violations: previous_violations
231
- }.merge(**main_violations))
231
+ }.merge(main_violations))
232
232
 
233
233
  comment_result =
234
234
  if should_create_new_comment
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "8.1.0".freeze
2
+ VERSION = "8.2.0".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
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.1.0
4
+ version: 8.2.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: 2020-10-17 00:00:00.000000000 Z
12
+ date: 2020-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -214,6 +214,7 @@ files:
214
214
  - lib/danger/ci_source/code_build.rb
215
215
  - lib/danger/ci_source/codefresh.rb
216
216
  - lib/danger/ci_source/codeship.rb
217
+ - lib/danger/ci_source/concourse.rb
217
218
  - lib/danger/ci_source/dotci.rb
218
219
  - lib/danger/ci_source/drone.rb
219
220
  - lib/danger/ci_source/github_actions.rb