Skip to content

Commit 31ba061

Browse files
author
Rynaard Burger
committed
Move the optionality of is_draft to create_release_action
1 parent a2c7934 commit 31ba061

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@ def create_milestone(repository:, title:, due_date:, days_until_submission:, day
119119
# @param [String] description The text to use as the release's body / description (typically the release notes)
120120
# @param [Array<String>] assets List of file paths to attach as assets to the release
121121
# @param [TrueClass|FalseClass] prerelease Indicates if this should be created as a pre-release (i.e. for alpha/beta)
122-
# @param [TrueClass|FalseClass] is_draft Indicates if this should be created as a draft release (defaults to true)
122+
# @param [TrueClass|FalseClass] is_draft Indicates if this should be created as a draft release
123123
#
124-
def create_release(repository:, version:, target: nil, description:, assets:, prerelease:, is_draft: true)
124+
def create_release(repository:, version:, target: nil, description:, assets:, prerelease:, is_draft:)
125125
release = client.create_release(
126126
repository,
127127
version, # tag name
128128
name: version, # release name
129129
target_commitish: target || Git.open(Dir.pwd).log.first.sha,
130-
draft: is_draft,
131130
prerelease: prerelease,
131+
draft: is_draft,
132132
body: description
133133
)
134134
assets.each do |file_path|

spec/github_helper_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def create_milestone(due_date:, days_until_submission:, days_until_release:)
398398
it 'has the correct options' do
399399
options = { body: test_description, draft: true, name: test_tag, prerelease: false, target_commitish: test_target }
400400
expect(client).to receive(:create_release).with(test_repo, test_tag, options)
401-
create_release
401+
create_release(is_draft: true)
402402
end
403403

404404
it 'uploads the assets to the correct location' do
@@ -407,13 +407,13 @@ def create_milestone(due_date:, days_until_submission:, days_until_release:)
407407

408408
allow(client).to receive(:create_release).and_return({ url: test_url })
409409
expect(client).to receive(:upload_asset).with(test_url, test_assets, { content_type: 'application/octet-stream' })
410-
create_release(assets: [test_assets])
410+
create_release(is_draft: true, assets: [test_assets])
411411
end
412412

413413
it 'creates a draft release if is_draft is set to true' do
414414
options_draft_release = { body: test_description, draft: true, name: test_tag, prerelease: false, target_commitish: test_target }
415415
expect(client).to receive(:create_release).with(test_repo, test_tag, options_draft_release)
416-
create_release
416+
create_release(is_draft: true)
417417
end
418418

419419
it 'creates a final (non-draft) release if is_draft is set to false' do
@@ -422,7 +422,7 @@ def create_milestone(due_date:, days_until_submission:, days_until_release:)
422422
create_release(is_draft: false)
423423
end
424424

425-
def create_release(assets: [], is_draft: true)
425+
def create_release(is_draft:, assets: [])
426426
helper = described_class.new(github_token: 'Fake-GitHubToken-123')
427427
helper.create_release(
428428
repository: test_repo,

0 commit comments

Comments
 (0)