Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr-publish: tweak wording and function names #7212

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/dev-cmd/pr-publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def pr_publish_args
def pr_publish
pr_publish_args.parse

odie "You need to specify a pull request number!" if Homebrew.args.named.empty?
odie "You need to specify at least one pull request number!" if Homebrew.args.named.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonchang There's a DSL to do this so you don't need the odie: https://github.com/Homebrew/brew/pull/7202/files#r396070600

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally and it didn’t seem to work with multiple arguments. Is there another DSL for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min_named. Sorry, thought from the help text it only took a single arg.


args.named.each do |arg|
arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive?
Expand All @@ -30,7 +30,7 @@ def pr_publish
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
odie "Not a GitHub pull request: #{arg}" unless issue
ohai "Dispatching #{tap} pull request ##{issue}"
GitHub.dispatch(user, repo, "Publish ##{issue}", pull_request: issue)
GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue)
end
end
end
2 changes: 1 addition & 1 deletion Library/Homebrew/utils/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def issue_comment_exists?(user, repo, pr, body)
comments.any? { |comment| comment["body"].eql?(body) }
end

def dispatch(user, repo, event, **payload)
def dispatch_event(user, repo, event, **payload)
url = "#{API_URL}/repos/#{user}/#{repo}/dispatches"
open_api(url, data: { event_type: event, client_payload: payload },
request_method: :POST,
Expand Down