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