danger-changelog 0.8.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 022eb51f3fa39d8abf589c65dd0c6ebabb20404289c3181447d26417a5ea7a52
4
- data.tar.gz: b20da654d12c3cb01061eb4dc329cf9b8cf5f7f83b2736798679fb551334458d
3
+ metadata.gz: 173f58cbaf43ff80a454e062c19f6674e0742c37fbd59c5bb4e85bc00c8d3899
4
+ data.tar.gz: 21ac5d08f53444c17cf3231880fc4f45beaca225970ecd1862002909ebbcf8fe
5
5
  SHA512:
6
- metadata.gz: 4ce70cd1afc862965c8abcf61a6626a29dc726d0a9cd8c6646f4898bde775024e088cb38b1725b88d3481f19cd11efca477094930d5e1442a113344c242ffb9a
7
- data.tar.gz: cfae9454953b6fd99ebf1187f74ecaec27d6fd2e44e03c2028c4b7b2632e5a27a0c24bd3fffd7a743bdf3b5dbf4ac96100bb0798ba2c93140fd7a3503fa96a0d
6
+ metadata.gz: 4e98417f1d4a0d74eeea613d876eca5b39dd5e12337255c08ba3598cde50731fce8533eaddd4b3bde26a20e84baa4674eff409a8b0564f4f539a2f23d0a0534b
7
+ data.tar.gz: ae509fd46287e51ab6a78ff32fbcfe69ca5c7841abc57f37e6f1a822ddb2d42a627687ca1ea30ff26c7bbbd06c2acb93f431aac3af8d932707c2030ebf73cb4d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.9.1 (Next)
4
+
5
+ * Your contribution here.
6
+
7
+ ### 0.9.0 (2026/10/14)
8
+
9
+ * [#72](https://github.com/dblock/danger-changelog/pull/72): Accept bot author links with a `[bot]` suffix without changing their attribution - [@dblock](https://github.com/dblock).
10
+
3
11
  ### 0.8.0 (2025/12/18)
4
12
 
5
13
  * [#70](https://github.com/dblock/danger-changelog/pull/70): Workflow postreview improvments - [@numbata](https://github.com/numbata).
data/Gemfile CHANGED
@@ -16,5 +16,6 @@ group :development, :test do
16
16
  gem 'rubocop-rake'
17
17
  gem 'rubocop-rspec'
18
18
  gem 'ruby-grape-danger'
19
+ gem 'tsort'
19
20
  gem 'yard', '~> 0.9.11'
20
21
  end
data/doc/intridea.md CHANGED
@@ -99,9 +99,12 @@ The Intridea style changelog was pioneered on the Hashie project. It has many el
99
99
  ```markdown
100
100
  * Entry without a PR link - [@ivoanjo](https://github.com/ivoanjo).
101
101
  * [#1](https://github.com/dblock/danger-changelog/pull/1): Entry with a PR link - [@dblock](https://github.com/dblock).
102
+ * [#2](https://github.com/dblock/danger-changelog/pull/2): Update dependencies - [@github-actions[bot]](https://github.com/apps/github-actions).
102
103
  * Yes, this is a weird entry, but it's still valid! Also Beyoncé is welcome here, as is 松本 行弘 and our nice emojis 👍 - [@ivoanjo](https://github.com/ivoanjo).
103
104
  ```
104
105
 
106
+ Bot author names may end in a literal `[bot]` suffix, such as `github-actions[bot]` or `dependabot[bot]`. Keep the suffix in the attribution; links to GitHub app pages and bot profiles are supported.
107
+
105
108
  ❌ Entry descriptions need to start with an uppercase A-Z letter
106
109
 
107
110
  ```markdown
@@ -4,6 +4,9 @@ module Danger
4
4
  module Changelog
5
5
  # A CHANGELOG.md line represents the change entry.
6
6
  class ChangelogEntryLine < ChangelogLine
7
+ AUTHOR_NAME = /[\w-]+(?:\[bot\])?/.freeze
8
+ AUTHOR_LINK = %r{\[@#{AUTHOR_NAME}\]\(https://github\.com/.*#{AUTHOR_NAME}\)}.freeze
9
+
7
10
  def valid?
8
11
  return validation_result.valid? if validation_result
9
12
 
@@ -12,8 +15,8 @@ module Danger
12
15
  validation_result.error! 'too many parenthesis' unless balanced?(line)
13
16
  return false if validation_result.invalid?
14
17
 
15
- return true if line =~ %r{^\*\s[`[:upper:]].*[^.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
16
- return true if line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[^.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
18
+ return true if line =~ /^\*\s[`[:upper:]].*[^.,] - #{AUTHOR_LINK}.$/
19
+ return true if line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[^.,] - #{AUTHOR_LINK}.$}
17
20
 
18
21
  validation_result.error! 'does not start with a star' unless ChangelogEntryLine.starts_with_star?(line)
19
22
  validation_result.error! 'does not include a pull request link' unless ChangelogEntryLine.with_pr_link?(line)
@@ -22,8 +25,8 @@ module Danger
22
25
  validation_result.error! 'has an extra trailing space' if ChangelogEntryLine.ends_with_space?(line)
23
26
  validation_result.error! 'is missing a period at the end of the line' unless ChangelogEntryLine.ends_with_period?(line)
24
27
  validation_result.error! 'has an extra period or comma at the end of the description' if
25
- line =~ %r{^\*\s[`[:upper:]].*[.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$} ||
26
- line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
28
+ line =~ /^\*\s[`[:upper:]].*[.,] - #{AUTHOR_LINK}.$/ ||
29
+ line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[.,] - #{AUTHOR_LINK}.$}
27
30
 
28
31
  false
29
32
  end
@@ -86,7 +89,7 @@ module Danger
86
89
 
87
90
  # checks whether line contains a MARKDOWN link to an author
88
91
  def self.with_author_link?(line)
89
- return true if line =~ %r{\[@[\w\d\-_]+\]\(https?://github\.com/.*[\w\d\-_]+/?\)}
92
+ return true if line =~ %r{\[@#{AUTHOR_NAME}\]\(https?://github\.com/.*#{AUTHOR_NAME}/?\)}
90
93
 
91
94
  false
92
95
  end
@@ -1,3 +1,3 @@
1
1
  module Changelog
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
@@ -113,5 +113,62 @@ describe Danger::Changelog::ChangelogEntryLine do
113
113
  expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
114
114
  end
115
115
  end
116
+
117
+ context 'with a bot author' do
118
+ let(:pr_title) { 'Update dependencies' }
119
+
120
+ %w[github-actions[bot] dependabot[bot]].each do |author|
121
+ it "generates a valid example for #{author}" do
122
+ allow(github).to receive(:pr_author).and_return(author)
123
+ example = described_class.example(github)
124
+ expect(example).to include("[@#{author}](https://github.com/#{author})")
125
+ expect(described_class.new(example).valid?).to be true
126
+ end
127
+ end
128
+ end
129
+ end
130
+
131
+ context 'with bot attribution' do
132
+ [
133
+ '[@github-actions[bot]](https://github.com/apps/github-actions)',
134
+ '[@dependabot[bot]](https://github.com/dependabot[bot])',
135
+ '[@renovate[bot]](https://github.com/apps/renovate)'
136
+ ].each do |author_link|
137
+ context author_link do
138
+ [
139
+ "* Update dependencies - #{author_link}.",
140
+ "* [#1](https://github.com/dblock/danger-changelog/pull/1): Update dependencies - #{author_link}."
141
+ ].each do |line|
142
+ it_behaves_like 'validates as changelog entry line', line
143
+ it_behaves_like 'valid changelog entry line', line
144
+ end
145
+
146
+ it 'recognizes an author link on its own' do
147
+ expect(described_class.with_author_link?(author_link)).to be true
148
+ end
149
+
150
+ ['.', ','].each do |punctuation|
151
+ it "reports an extra #{punctuation} at the end of the description" do
152
+ entry = described_class.new("* Update dependencies#{punctuation} - #{author_link}.\n")
153
+ expect(entry.valid?).to be false
154
+ expect(entry.validation_result.errors)
155
+ .to include('has an extra period or comma at the end of the description')
156
+ end
157
+ end
158
+
159
+ it_behaves_like 'invalid changelog entry line', "* Update dependencies - #{author_link}"
160
+ it_behaves_like 'invalid changelog entry line', "* Update dependencies - #{author_link}. \n"
161
+ it_behaves_like 'invalid changelog entry line', "* Update dependencies - #{author_link.sub('https:', 'http:')}."
162
+ it_behaves_like 'invalid changelog entry line', "* Update dependencies - #{author_link.sub('github.com', 'gitlab.com')}."
163
+ end
164
+ end
165
+
166
+ %w[github-actions[Bot] github-actions[bot]extra github-actions[bot][bot] github-actions[]].each do |author|
167
+ it "rejects malformed bot suffix in #{author}" do
168
+ link = "[@#{author}](https://github.com/apps/github-actions)"
169
+ expect(described_class.with_author_link?(link)).to be false
170
+ expect(described_class.new("* Update dependencies - #{link}.").valid?).to be false
171
+ end
172
+ end
116
173
  end
117
174
  end
@@ -6,6 +6,15 @@ describe Danger::Changelog::ChangelogFile do
6
6
  end
7
7
 
8
8
  describe 'with the default format checker' do
9
+ context 'with bot authors' do
10
+ let(:filename) { File.expand_path('fixtures/bot_authors.md', __dir__) }
11
+
12
+ it 'accepts bot entries in a complete changelog' do
13
+ expect(subject.bad_lines).to eq []
14
+ expect(subject.global_failures?).to be false
15
+ end
16
+ end
17
+
9
18
  context 'minimal example' do
10
19
  let(:filename) { File.expand_path('fixtures/minimal.md', __dir__) }
11
20
 
@@ -0,0 +1,5 @@
1
+ ### Next
2
+
3
+ * [#1](https://github.com/dblock/danger-changelog/pull/1): Update dependencies - [@github-actions[bot]](https://github.com/apps/github-actions).
4
+ * Update dependencies - [@dependabot[bot]](https://github.com/dependabot[bot]).
5
+ * Your contribution here.
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dblock
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-10-14 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: danger-plugin-api
@@ -77,6 +78,7 @@ files:
77
78
  - spec/intridea/changelog_line_parser_spec.rb
78
79
  - spec/intridea/changelog_placeholder_line_spec.rb
79
80
  - spec/intridea/changelog_spec.rb
81
+ - spec/intridea/fixtures/bot_authors.md
80
82
  - spec/intridea/fixtures/customized.md
81
83
  - spec/intridea/fixtures/dates.md
82
84
  - spec/intridea/fixtures/extra_trailing_space.md
@@ -100,6 +102,7 @@ licenses:
100
102
  - MIT
101
103
  metadata:
102
104
  rubygems_mfa_required: 'true'
105
+ post_install_message:
103
106
  rdoc_options: []
104
107
  require_paths:
105
108
  - lib
@@ -114,7 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
117
  - !ruby/object:Gem::Version
115
118
  version: '0'
116
119
  requirements: []
117
- rubygems_version: 3.6.8
120
+ rubygems_version: 3.5.16
121
+ signing_key:
118
122
  specification_version: 4
119
123
  summary: A danger.systems plugin that is OCD about your CHANGELOG.
120
124
  test_files: []