Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extract_release_notes_for_version to return the extracted release notes without saving to a file #623

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _None_
### New Features

- Introduce new `openai_ask` action to get responses to a prompt/question from OpenAI API. [#621]
- Allow `extract_release_notes_for_version` to return the extracted release notes without saving to a file. [#623]

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ def self.run(params)
release_notes_file_path = params[:release_notes_file_path]
extracted_notes_file_path = params[:extracted_notes_file_path]

extracted_notes_file = File.open(extracted_notes_file_path, 'w') unless extracted_notes_file_path.blank?

extracted_notes = ''
extract_notes(release_notes_file_path, version) do |line|
extracted_notes_file.nil? ? puts(line) : extracted_notes_file.write(line)
extracted_notes += line
end
extracted_notes.chomp!('') # Remove any extra empty line(s) at the end

return if extracted_notes_file.nil?
unless extracted_notes_file_path.nil? || extracted_notes_file_path.empty?
File.write(extracted_notes_file_path, extracted_notes)
commit_extracted_notes_file(extracted_notes_file_path, version)
end

extracted_notes_file.close
commit_extracted_notes_file(extracted_notes_file_path, version)
extracted_notes
end

def self.extract_notes(release_notes_file_path, version)
Expand Down Expand Up @@ -57,7 +59,7 @@ def self.authors
end

def self.return_value
# If your method provides a return value, you can describe here what it does
'The content of the extracted release notes (the same text as what was written in the `extracted_notes_file_path` if one was provided)'
end

def self.details
Expand Down
Loading