-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
bump-*-pr: handle HOMEBREW_NO_GITHUB_API=1 being set #16925
Conversation
@gibfahn Can you explain the motivation for this rather than what it does? |
We have automation using these commands in taps other than homebrew/core and homebrew/cask. Also I have wanted to be able to run this locally to do version replacement without needing public internet access. |
ed97ea3
to
b3f7cc2
Compare
@gibfahn I still don't understand the motivation here, sorry. You have automation: why/how is that effected by the existing behaviour? |
f491dd4
to
ab98bfd
Compare
Sorry, I didn't dig into this enough. Have now used pry to do more digging, and it seems to be a missing nil check caused by |
Library/Homebrew/utils/github.rb
Outdated
@@ -562,6 +562,7 @@ def self.fetch_pull_requests(name, tap_remote_repo, state: nil, version: nil) | |||
|
|||
pull_requests = [] | |||
API.paginate_graphql(graphql_query, variables:) do |result| | |||
return [] if result.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to the beginning of the fetch_pull_requests
method instead and check the specific variable used? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to check the env var directly, let me know if this is what you had in mind.
ab98bfd
to
909b597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @gibfahn!
|
We early return here https://github.com/homebrew/brew/blob/92a4311868322188478d7a90511ec0e8e6b0d7df/Library/Homebrew/utils/github/api.rb#L220 , but don't then handle that through the stack. Repro: ```console ❯ HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_GITHUB_API=1 brew bump-formula-pr --write-only --version 1.2.3 --no-audit jq Error: undefined method `[]' for nil:NilClass Do not report this issue until you've run `brew update` and tried again. Warning: Removed Sorbet lines from backtrace! /opt/homebrew/Library/Homebrew/utils/github.rb:565:in `block in fetch_pull_requests' /opt/homebrew/Library/Homebrew/utils/github/api.rb:334:in `paginate_graphql' /opt/homebrew/Library/Homebrew/utils/github.rb:564:in `fetch_pull_requests' /opt/homebrew/Library/Homebrew/utils/github.rb:628:in `check_for_duplicate_pull_requests' /opt/homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:456:in `check_open_pull_requests' /opt/homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:135:in `run' /opt/homebrew/Library/Homebrew/brew.rb:89:in `<main>' Rerun with `--verbose` to see the original backtrace ```
909b597
to
e11f797
Compare
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Commits (oldest to newest)
e11f797 bump-*-pr: handle HOMEBREW_NO_GITHUB_API=1 being set
We early return here
https://github.com/homebrew/brew/blob/92a4311868322188478d7a90511ec0e8e6b0d7df/Library/Homebrew/utils/github/api.rb#L220
, but don't then handle that through the stack.
Repro: