Port Homebrew::DevCmd::PrPublish
This commit is contained in:
parent
972e853ec0
commit
b37274de8b
@ -1,15 +1,14 @@
|
||||
# typed: true
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
require "cli/parser"
|
||||
require "utils/github"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def pr_publish_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module DevCmd
|
||||
class PrPublish < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Publish bottles for a pull request with GitHub Actions.
|
||||
Requires write access to the repository.
|
||||
@ -31,11 +30,9 @@ module Homebrew
|
||||
|
||||
named_args :pull_request, min: 1
|
||||
end
|
||||
end
|
||||
|
||||
def pr_publish
|
||||
args = pr_publish_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||
workflow = args.workflow || "publish-commit-bottles.yml"
|
||||
ref = args.branch || "master"
|
||||
@ -72,4 +69,6 @@ module Homebrew
|
||||
GitHub.workflow_dispatch_event(user, repo, workflow, ref, **inputs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
require "dev-cmd/pr-publish"
|
||||
|
||||
RSpec.describe "brew pr-publish" do
|
||||
it_behaves_like "parseable arguments"
|
||||
RSpec.describe Homebrew::DevCmd::PrPublish do
|
||||
it_behaves_like "parseable arguments", argv: ["foo"]
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user