Skip to content

Commit

Permalink
Merge pull request #4756 from dependabot/brrygrdn/fix-bump-version-sc…
Browse files Browse the repository at this point in the history
…ript

Fix references to changelog path/contents in bump_version.rb
  • Loading branch information
brrygrdn authored Feb 22, 2022
2 parents 9c4ab72 + 3f38d50 commit 93507b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/bump-version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
exit 1
end

CHANGELOG_PATH = File.join(__dir__, "..", "CHANGELOG.md")
CHANGELOG_CONTENTS = File.read(CHANGELOG_PATH)

def proposed_changes(version, _new_version)
dependabot_team = `gh api -X GET 'orgs/dependabot/teams/reviewers/members' --jq '.[].login'`
dependabot_team = dependabot_team.split("\n").map(&:strip) + ["dependabot"]
changelog_path = File.join(__dir__, "..", "CHANGELOG.md")
changelog_contents = File.read(changelog_path)

commit_subjects = `git log --pretty="%s" v#{version}..HEAD`.lines
merge_subjects = commit_subjects.select do |s|
Expand Down Expand Up @@ -85,10 +86,10 @@ def proposed_changes(version, _new_version)
new_changelog_contents = [
"## v#{new_version}, #{Time.now.strftime('%e %B %Y').strip}\n",
proposed_changes.join("\n") + "\n",
changelog_contents
CHANGELOG_CONTENTS
].join("\n")

File.open(changelog_path, "w") { |f| f.write(new_changelog_contents) }
File.open(CHANGELOG_PATH, "w") { |f| f.write(new_changelog_contents) }
puts "☑️ CHANGELOG.md updated"
end

Expand Down

0 comments on commit 93507b8

Please sign in to comment.