pr-publish: support dispatching with autosquash
This commit is contained in:
		
							parent
							
								
									2d5ba777d6
								
							
						
					
					
						commit
						8ac9608787
					
				@ -14,6 +14,12 @@ module Homebrew
 | 
			
		||||
        Publish bottles for a pull request with GitHub Actions.
 | 
			
		||||
        Requires write access to the repository.
 | 
			
		||||
      EOS
 | 
			
		||||
      switch "--autosquash",
 | 
			
		||||
             description: "If supported on the target tap, automatically reformat and reword commits "\
 | 
			
		||||
                          "in the pull request to our preferred format."
 | 
			
		||||
      flag   "--message=",
 | 
			
		||||
             depends_on:  "--autosquash",
 | 
			
		||||
             description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
 | 
			
		||||
      flag   "--tap=",
 | 
			
		||||
             description: "Target tap repository (default: `homebrew/core`)."
 | 
			
		||||
      flag   "--workflow=",
 | 
			
		||||
@ -30,6 +36,11 @@ module Homebrew
 | 
			
		||||
    workflow = args.workflow || "publish-commit-bottles.yml"
 | 
			
		||||
    ref = "master"
 | 
			
		||||
 | 
			
		||||
    extra_args = []
 | 
			
		||||
    extra_args << "--autosquash" if args.autosquash?
 | 
			
		||||
    extra_args << "--message='#{args.message}'" if args.message.presence
 | 
			
		||||
    dispatch_args = extra_args.join " "
 | 
			
		||||
 | 
			
		||||
    args.named.uniq.each do |arg|
 | 
			
		||||
      arg = "#{tap.default_remote}/pull/#{arg}" if arg.to_i.positive?
 | 
			
		||||
      url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
 | 
			
		||||
@ -40,7 +51,7 @@ module Homebrew
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      ohai "Dispatching #{tap} pull request ##{issue}"
 | 
			
		||||
      GitHub.workflow_dispatch_event(user, repo, workflow, ref, pull_request: issue)
 | 
			
		||||
      GitHub.workflow_dispatch_event(user, repo, workflow, ref, pull_request: issue, args: dispatch_args)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -1119,6 +1119,10 @@ Find pull requests that can be automatically merged using `brew pr-publish`.
 | 
			
		||||
Publish bottles for a pull request with GitHub Actions.
 | 
			
		||||
Requires write access to the repository.
 | 
			
		||||
 | 
			
		||||
* `--autosquash`:
 | 
			
		||||
  If supported on the target tap, automatically reformat and reword commits in the pull request to our preferred format.
 | 
			
		||||
* `--message`:
 | 
			
		||||
  Message to include when autosquashing revision bumps, deletions, and rebuilds.
 | 
			
		||||
* `--tap`:
 | 
			
		||||
  Target tap repository (default: `homebrew/core`).
 | 
			
		||||
* `--workflow`:
 | 
			
		||||
 | 
			
		||||
@ -1576,6 +1576,14 @@ Include pull requests that have failing status checks\.
 | 
			
		||||
Publish bottles for a pull request with GitHub Actions\. Requires write access to the repository\.
 | 
			
		||||
.
 | 
			
		||||
.TP
 | 
			
		||||
\fB\-\-autosquash\fR
 | 
			
		||||
If supported on the target tap, automatically reformat and reword commits in the pull request to our preferred format\.
 | 
			
		||||
.
 | 
			
		||||
.TP
 | 
			
		||||
\fB\-\-message\fR
 | 
			
		||||
Message to include when autosquashing revision bumps, deletions, and rebuilds\.
 | 
			
		||||
.
 | 
			
		||||
.TP
 | 
			
		||||
\fB\-\-tap\fR
 | 
			
		||||
Target tap repository (default: \fBhomebrew/core\fR)\.
 | 
			
		||||
.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user