Port Homebrew::DevCmd::PrPublish

This commit is contained in:
Douglas Eichelberger 2024-03-21 17:29:01 -07:00
parent 972e853ec0
commit b37274de8b
2 changed files with 64 additions and 64 deletions

View File

@ -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

View File

@ -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