Skip to content

Commit

Permalink
[DOC] Exclude dependabot from ChangeLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Apr 17, 2024
1 parent 8d33e4c commit 98ce2c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions rakelib/changelogs.rake
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Requires >= ruby 2.4, for `each(chomp: true)`

task "build" => "changelogs"

changelog = proc do |output, ver = nil, prev = nil|
ver &&= Gem::Version.new(ver)
range = [[prev], [ver, "HEAD"]].map {|ver, branch| ver ? "v#{ver.to_s}" : branch}.compact.join("..")
cmd = %W[git log --date=iso --format=fuller --topo-order --no-merges
--invert-grep --fixed-strings --grep=#{'[ci skip]'}
--invert-grep --fixed-strings --grep=#{'[ci skip]'} -z
#{range} --]
IO.popen(cmd) do |log|
line = log.gets
FileUtils.mkpath(File.dirname(output))
File.open(output, "wb") do |f|
f.print "-*- coding: utf-8 -*-\n\n", line
log.each_line do |line|
line.sub!(/^(?!:)(?:Author|Commit)?(?:Date)?: /, ' \&')
line.sub!(/ +$/, '')
f.print(line)
log.each("\0", chomp: true) do |line|
next if /^Author: *dependabot\[bot\]/ =~ line
line.gsub!(/^(?!:)(?:Author|Commit)?(?:Date)?: /, ' \&')
line.gsub!(/ +$/, '')
f.print(line, "\n")
end
end
end
Expand Down

0 comments on commit 98ce2c5

Please sign in to comment.