Skip to content

Commit c829b8d

Browse files
committed
Rename action to openai_ask
1 parent 11a7b37 commit c829b8d

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/openai_generate_action.rb renamed to lib/fastlane/plugin/wpmreleasetoolkit/actions/common/openai_ask_action.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module Fastlane
66
module Actions
7-
class OpenaiGenerateAction < Action
7+
class OpenaiAskAction < Action
88
OPENAI_API_ENDPOINT = URI('https://api.openai.com/v1/chat/completions').freeze
99

1010
PREDEFINED_PROMPTS = {
@@ -90,7 +90,7 @@ def self.examples
9090
[
9191
<<~EXEMPLE,
9292
items = extract_release_notes_for_version(version: app_version, release_notes_file_path: 'RELEASE-NOTES.txt')
93-
nice_changelog = openai_generate(
93+
nice_changelog = openai_ask(
9494
prompt: :release_notes, # Uses the pre-crafted prompt for App Store / Play Store release notes
9595
question: "Help me write release notes for the following items:\n#{items}",
9696
api_token: get_required_env('OPENAI_API_TOKEN')
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
require 'spec_helper'
22

3-
describe Fastlane::Actions::OpenaiGenerateAction do
3+
describe Fastlane::Actions::OpenaiAskAction do
44
let(:fake_token) { 'sk-proj-faketok' }
5-
let(:endpoint) { Fastlane::Actions::OpenaiGenerateAction::OPENAI_API_ENDPOINT }
6-
let(:release_notes_prompt) { Fastlane::Actions::OpenaiGenerateAction::PREDEFINED_PROMPTS[:release_notes] }
5+
let(:endpoint) { Fastlane::Actions::OpenaiAskAction::OPENAI_API_ENDPOINT }
76

87
def stubbed_response(text)
98
<<~JSON
@@ -71,7 +70,7 @@ def run_test(prompt_param:, question_param:, expected_prompt:, expected_response
7170
expect(messages[1]['content']).to eq(['type' => 'text', 'text' => question_param])
7271
end
7372

74-
# Ensure the request has been made and the response is as expected
73+
# Ensure the request has been made and return the action response for it to be validated in calling test
7574
expect(stub).to have_been_requested
7675
result
7776
end
@@ -108,7 +107,7 @@ def run_test(prompt_param:, question_param:, expected_prompt:, expected_response
108107
result = run_test(
109108
prompt_param: :release_notes,
110109
question_param: "Help me write release notes for the following items:\n#{changelog}",
111-
expected_prompt: release_notes_prompt,
110+
expected_prompt: Fastlane::Actions::OpenaiAskAction::PREDEFINED_PROMPTS[:release_notes],
112111
expected_response: expected_response
113112
)
114113

0 commit comments

Comments
 (0)