Skip to content

Commit b9a3b12

Browse files
committed
Polish dry-run release command preview helper
1 parent 0878106 commit b9a3b12

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

rakelib/release.rake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,14 @@ def ensure_git_tag_exists!(gem_root:, tag:)
367367
abort "❌ Git tag #{tag.inspect} was not found locally or remotely. Verify the tag exists before syncing GitHub release."
368368
end
369369

370-
def github_release_command(gem_root:, release_context:, notes_file_path:, probe_existing: true)
370+
def github_release_command(gem_root: nil, release_context:, notes_file_path:, probe_existing: true)
371371
create_command = ["gh", "release", "create", release_context[:tag], "--verify-tag", "--title", release_context[:title],
372372
"--notes-file", notes_file_path]
373373
create_command << "--prerelease" if release_context[:prerelease]
374374
return create_command unless probe_existing
375375

376+
abort "❌ Internal error: github_release_command requires gem_root when probe_existing is true." unless gem_root
377+
376378
release_exists = system("gh", "release", "view", release_context[:tag], chdir: gem_root, out: File::NULL, err: File::NULL)
377379
abort "❌ Unable to run `gh`. Ensure GitHub CLI is installed and on PATH." if release_exists.nil?
378380

@@ -391,9 +393,8 @@ def publish_or_update_github_release(gem_root:, release_context:, dry_run:)
391393

392394
if dry_run
393395
preview_command = github_release_command(
394-
gem_root: gem_root,
395396
release_context: release_context,
396-
notes_file_path: "<release-notes-file>",
397+
notes_file_path: "release-notes-file",
397398
probe_existing: false
398399
)
399400
puts "DRY RUN: Would create or update GitHub release #{release_context[:tag]}#{release_context[:prerelease] ? ' (prerelease)' : ''}"

0 commit comments

Comments
 (0)