dev-cmd/pr-pu{ll,blish}: handle PRs with an autosquash label
- request `autosquash` from the publish job in `pr-publish` if the PR is labelled with `autosquash` - show a warning in `pr-pull` if called without `--autosquash` on a PR with the autosquash label.
This commit is contained in:
parent
76833dfe40
commit
f0272b0944
@ -67,6 +67,10 @@ module Homebrew
|
|||||||
|
|
||||||
inputs[:pull_request] = issue
|
inputs[:pull_request] = issue
|
||||||
|
|
||||||
|
pr_labels = GitHub.pull_request_labels(user, repo, issue)
|
||||||
|
oh1 "Found `autosquash` label on ##{issue}. Requesting autosquash."
|
||||||
|
inputs[:autosquash] = true if pr_labels.include?("autosquash")
|
||||||
|
|
||||||
if args.tap.present? && !T.must("#{user}/#{repo}".casecmp(tap.full_name)).zero?
|
if args.tap.present? && !T.must("#{user}/#{repo}".casecmp(tap.full_name)).zero?
|
||||||
odie "Pull request URL is for #{user}/#{repo} but `--tap=#{tap.full_name}` was specified!"
|
odie "Pull request URL is for #{user}/#{repo} but `--tap=#{tap.full_name}` was specified!"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -308,11 +308,9 @@ module Homebrew
|
|||||||
Utils::Git.cherry_pick!(path, "--ff", "--allow-empty", *commits, verbose: args.verbose?, resolve: args.resolve?)
|
Utils::Git.cherry_pick!(path, "--ff", "--allow-empty", *commits, verbose: args.verbose?, resolve: args.resolve?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.formulae_need_bottles?(tap, original_commit, user, repo, pull_request, args:)
|
def self.formulae_need_bottles?(tap, original_commit, labels, args:)
|
||||||
return if args.dry_run?
|
return if args.dry_run?
|
||||||
|
|
||||||
labels = GitHub.pull_request_labels(user, repo, pull_request)
|
|
||||||
|
|
||||||
return false if labels.include?("CI-syntax-only") || labels.include?("CI-no-bottles")
|
return false if labels.include?("CI-syntax-only") || labels.include?("CI-no-bottles")
|
||||||
|
|
||||||
changed_packages(tap, original_commit).any? do |f|
|
changed_packages(tap, original_commit).any? do |f|
|
||||||
@ -456,6 +454,11 @@ module Homebrew
|
|||||||
opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?"
|
opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pr_labels = GitHub.pull_request_labels(user, repo, pr)
|
||||||
|
if pr_labels.include?("autosquash") && !args.autosquash?
|
||||||
|
opoo "Pull request is labelled `autosquash`: do you need to pass `--autosquash`?"
|
||||||
|
end
|
||||||
|
|
||||||
pr_check_conflicts("#{user}/#{repo}", pr)
|
pr_check_conflicts("#{user}/#{repo}", pr)
|
||||||
|
|
||||||
ohai "Fetching #{tap} pull request ##{pr}"
|
ohai "Fetching #{tap} pull request ##{pr}"
|
||||||
@ -478,7 +481,7 @@ module Homebrew
|
|||||||
signoff!(tap.path, pull_request: pr, dry_run: args.dry_run?) unless args.clean?
|
signoff!(tap.path, pull_request: pr, dry_run: args.dry_run?) unless args.clean?
|
||||||
end
|
end
|
||||||
|
|
||||||
unless formulae_need_bottles?(tap, original_commit, user, repo, pr, args: args)
|
unless formulae_need_bottles?(tap, original_commit, pr_labels, args: args)
|
||||||
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user