Skip to content

Commit

Permalink
Merge pull request #9485 from koic/support_co_contributor_signature
Browse files Browse the repository at this point in the history
Support co-contributor signature for changelog build
  • Loading branch information
koic authored Feb 1, 2021
2 parents b614ba8 + fbae4aa commit 851741b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tasks/changelog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Changelog
REF_URL = 'https://github.com/rubocop-hq/rubocop'
MAX_LENGTH = 40
CONTRIBUTOR = '[@%<user>s]: https://github.com/%<user>s'
SIGNATURE = Regexp.new(format(Regexp.escape("([@%<user>s][])\n"), user: '([\w-]+)'))
SIGNATURE = Regexp.new(format(Regexp.escape('[@%<user>s][]'), user: '([\w-]+)'))
EOF = "\n"

# New entry
Expand Down Expand Up @@ -143,8 +143,11 @@ def new_contributor_lines
end

def contributors
@entries.values.join("\n")
.scan(SIGNATURE).flatten
contributors = @entries.values.flat_map do |entry|
entry.match(/\. \((?<contributors>.+)\)\n/)[:contributors].split(',')
end

contributors.join.scan(SIGNATURE).flatten
end

private
Expand Down

0 comments on commit 851741b

Please sign in to comment.