danger 8.2.3 → 8.3.1

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: cd811a6fad28534b9e0b28ccbed30d0694e4ab3408ad22852a8897a56c55f2ed
4
- data.tar.gz: 747e7a6ff6fce272eb7b732ced8f6358602159725e5490a3ce783f7ce06dcc83
3
+ metadata.gz: 78727e10312d96889e8e0fe3dcf38c1ec9137932972eb2538f9d39e0c114ef1c
4
+ data.tar.gz: 57bbfff9bf004e91e3e900b87a80d34c3aebb749cc473e3a9496be8fd61652b2
5
5
  SHA512:
6
- metadata.gz: 54612a3b0e7999fce7289a884febff1548edbfa92af9947a8c8cc4bbef5fa69451ac88b493bc2ba0125e23ef96f7a46846a7a3b1e7adb8ac4d8f98aafa0065ce
7
- data.tar.gz: 6612a1c511c7fe579c2734f6b4c8b15955dc2a2dd196a4a0277a901d61307b58c2abdd7f000867c1f212d2db065b39c8dfcd9f83c774154b1089a37395f45096
6
+ metadata.gz: 7be9c56ed729037d9b2c557e9a349e4ba091226c2ff4caa2b37c8432bdf2c515f7343ce9cf744797d79681b8cbdf50e03584d91551da03aa82509884f151c461
7
+ data.tar.gz: dcfd5b78ad9d722a040737f7b0c64718d55297821ebf1d0bb3e78bddb46939d9331bc772b2cd398b00cadf33daff49e69001d1618fb2ece3e167185282e3a379
@@ -0,0 +1,58 @@
1
+ # https://docs.codemagic.io/building/environment-variables/
2
+
3
+ module Danger
4
+ # ### CI Setup
5
+ #
6
+ # Add a script step to your workflow:
7
+ #
8
+ # ```
9
+ # - name: Running Danger
10
+ # script: |
11
+ # bundle install
12
+ # bundle exec danger
13
+ # ```
14
+ #
15
+ # ### Token Setup
16
+ #
17
+ # Add the following environment variables to your workflow's environment configuration.
18
+ # https://docs.codemagic.io/getting-started/yaml/
19
+ #
20
+ # #### GitHub
21
+ # Add the `DANGER_GITHUB_API_TOKEN` to your build user's ENV.
22
+ #
23
+ # #### GitLab
24
+ # Add the `DANGER_GITLAB_API_TOKEN` to your build user's ENV.
25
+ #
26
+ # #### Bitbucket Cloud
27
+ # Add the `DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD`
28
+ # to your build user's ENV.
29
+ #
30
+ # #### Bitbucket server
31
+ # Add the `DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD`
32
+ # and `DANGER_BITBUCKETSERVER_HOST` to your build user's ENV.
33
+ #
34
+ class Codemagic < CI
35
+ def self.validates_as_ci?(env)
36
+ env.key? "FCI_PROJECT_ID"
37
+ end
38
+
39
+ def self.validates_as_pr?(env)
40
+ return !env["FCI_PULL_REQUEST_NUMBER"].to_s.empty?
41
+ end
42
+
43
+ def supported_request_sources
44
+ @supported_request_sources ||= [
45
+ Danger::RequestSources::GitHub,
46
+ Danger::RequestSources::GitLab,
47
+ Danger::RequestSources::BitbucketServer,
48
+ Danger::RequestSources::BitbucketCloud
49
+ ]
50
+ end
51
+
52
+ def initialize(env)
53
+ self.pull_request_id = env["FCI_PULL_REQUEST_NUMBER"]
54
+ self.repo_slug = env["FCI_REPO_SLUG"]
55
+ self.repo_url = GitRepo.new.origins # Codemagic doesn't provide a repo url env variable for n
56
+ end
57
+ end
58
+ end
@@ -133,7 +133,7 @@ module Danger
133
133
  matches = change_url.match(%r{(.+)\/pull\/[0-9]+})
134
134
  matches[1] unless matches.nil?
135
135
  when %r{\/merge_requests\/} # GitLab
136
- matches = change_url.match(%r{(.+)\/merge_requests\/[0-9]+})
136
+ matches = change_url.match(%r{(.+?)(\/-)?\/merge_requests\/[0-9]+})
137
137
  matches[1] unless matches.nil?
138
138
  when %r{\/pull-requests\/} # Bitbucket
139
139
  matches = change_url.match(%r{(.+)\/pull-requests\/[0-9]+})
@@ -17,10 +17,5 @@
17
17
  <%= current %>
18
18
  <%# the previous line has to be aligned far to the left, otherwise markdown can break easily %>
19
19
  <%- end -%>
20
- <%# We need to add the generated_by_ to identify comments from danger. But with inlines %>
21
- <%# it might be a little annoying, so we set on the table, but if we have markdown we add the footer anyway %>
22
- <%- if @markdowns.count > 0 -%>
23
- <p align="right" data-meta="generated_by_<%= @danger_id %>">
24
- Generated by :no_entry_sign: <a href="http://danger.systems/">Danger</a>
25
- </p>
26
- <%- end -%>
20
+ <%# Add the generated_by_ as a html coment to identify comments from danger. %>
21
+ <!-- "generated_by_<%= @danger_id %>" -->
@@ -143,6 +143,14 @@ module Danger
143
143
  @github.issue_json["labels"].map { |l| l[:name] }
144
144
  end
145
145
 
146
+ # @!group PR Metadata
147
+ # Whether the PR is a Draft.
148
+ # @return [Boolean]
149
+ #
150
+ def pr_draft?
151
+ pr_json["mergeable_state"] == "draft"
152
+ end
153
+
146
154
  # @!group PR Commit Metadata
147
155
  # The branch to which the PR is going to be merged into.
148
156
  # @return [String]
@@ -131,6 +131,14 @@ module Danger
131
131
  @gitlab.mr_diff
132
132
  end
133
133
 
134
+ # @!group MR Changes
135
+ # The array of changes
136
+ # @return [Array<Gitlab::ObjectifiedHash>]
137
+ #
138
+ def mr_changes
139
+ @gitlab.mr_changes.changes
140
+ end
141
+
134
142
  # @!group MR Commit Metadata
135
143
  # The branch to which the MR is going to be merged into
136
144
  # @deprecated Please use {#branch_for_base} instead
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "8.2.3".freeze
2
+ VERSION = "8.3.1".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.2.3
4
+ version: 8.3.1
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-03-10 00:00:00.000000000 Z
12
+ date: 2021-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -219,6 +219,7 @@ files:
219
219
  - lib/danger/ci_source/cirrus.rb
220
220
  - lib/danger/ci_source/code_build.rb
221
221
  - lib/danger/ci_source/codefresh.rb
222
+ - lib/danger/ci_source/codemagic.rb
222
223
  - lib/danger/ci_source/codeship.rb
223
224
  - lib/danger/ci_source/concourse.rb
224
225
  - lib/danger/ci_source/dotci.rb