1622 Commits

Author SHA1 Message Date
Elijah Olmos
ba4dfb2664
Update Library/Homebrew/utils/github.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-11-17 15:06:34 -07:00
Elijah Olmos
3922140f9a
push uncommitted code 2024-11-15 18:07:48 -07:00
Elijah Olmos
d068496aa5
chore: remove debug statement 2024-11-15 17:49:10 -07:00
Elijah Olmos
4653d5889e
fix: too_many_open_prs() fails without SSO access 2024-11-15 16:25:06 -07:00
Carlo Cabrera
1fbe4366a0
Support setting GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL
Our autobump workflow sets the author and committer to the user who
triggered the workflow, defaulting to @BrewTestBot for scheduled runs.

This can be confusing for maintainers when GitHub shows up as
"Unverified" because the commit is signed with @BrewTestBot's key.[^1]

Let's fix that by configuring our autobump workflow to always commit as
@BrewTestBot, so that the committer matches the GPG signature. To do
that, we need to add support for setting `GIT_COMMITTER_NAME` and
`GIT_COMMITTER_EMAIL`.

[^1]: See, for example, Homebrew/homebrew-core#197234.
2024-11-11 18:45:38 +08:00
Douglas Eichelberger
521c463e36
Manually resolve Style/SafeNavigationChainLength violations 2024-11-05 16:44:12 +00:00
Douglas Eichelberger
ffb15ffcf5
brew style --fix 2024-11-05 16:44:12 +00:00
Michael Cho
f82c58383c
utils/inreplace: allow non-global substitution
Also increase test coverage
2024-10-29 20:15:47 -04:00
Bo Anderson
ddfe04a601
Merge pull request #18516 from Homebrew/lockf-macos-15
utils/lock: use new lockf where available
2024-10-25 03:09:12 +01:00
Sam Ford
4ed2eb6811
curl: handle multiple Content-Type headers
`#curl_http_content_headers_and_checksum` contains code that works
with a `Content-Type` header in a response but it expects there to
always be only one header in the response. This is normally a
reasonable assumption but we've come across a server that is giving
a response with multiple `Content-Type` headers in the response, so
this produces an error and causes `brew audit` to fail when checking
the URL.

This works around the issue by naively using the last `Content-Type`
header in the response when there's more than one. It's not something
that should normally occur but this will handle the situation when it
does.
2024-10-19 18:02:06 -04:00
Carlo Cabrera
7a8f9fa489
extend/kernel: fix duplicate messages in GitHub Actions
Calls to `opoo` and `onoe` produce duplicate `Warning:` and `Error:`
messages in CI logs because we print something to stdout and print an
annotation. Annotations also produce `Error:` and `Warning:` lines in
the log.

Let's fix this by skipping printing the message if we've already printed
an annotation.
2024-10-14 12:15:24 +08:00
Bo Anderson
60a963a07e
utils/lock: use new lockf where available 2024-10-05 19:17:08 +01:00
Michael Cho
43ee408793
utils/curl: workaround curl bug for --head --request GET
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: https://github.com/Homebrew/brew/issues/18213
2024-10-05 14:05:59 -04:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Bevan Kay
53e8739d24
utils/shared_audits: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Bob Lail
c752c00ac6 brew vendor-gems: commit updates. 2024-09-27 14:44:40 -07:00
Bo Anderson
567f5eb4be
Allow sockets to use longer paths on macOS 2024-09-27 04:37:03 +01:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Mike McQuaid
1c390093f8
Revert "Limit usage of GitHub Actions Annotations" 2024-09-16 16:52:03 +01:00
Carlo Cabrera
c6e2cd9037
Limit usage of GitHub Actions Annotations
- only use annotations for `opoo` and `onoe` if
  `HOMEBREW_GITHUB_ACTIONS` is set. This will make using `brew` less
  noisy in GitHub Actions for third parties. See
  Homebrew/discussions#5602.
- if we've already called `puts_annotation_if_env_set`, then we no
  longer need to print the message to `$stderr`. The message from the
  annotation already show up in the GitHub Actions log, so printing to
  `$stderr` just leads to duplicate messages in the log.

While we're here, let's make sure to forward the `file:` and `line:`
kwargs of `puts_annotation_if_env_set` to the `Annotation` constructor.
2024-09-15 11:31:54 +08:00
Mike McQuaid
c8e8aa5600
Merge pull request #17756 from reitermarkus/concurrent-downloads
Implement concurrent downloads in `brew fetch`.
2024-09-09 08:41:11 +01:00
Bo Anderson
d8d9151c8c
Merge pull request #18283 from Homebrew/annotation-titles
github/actions: fix annotation title handling
2024-09-09 02:55:16 +01:00
Carlo Cabrera
54383d1c5f
github/actions: fix annotation title handling
We currently generate invalid workflow commands when we create
annotations with a `title` but no `file`. Let's fix that.

While we're here, let's improve handling of `title`s with `:`s. We
cannot use `title`s with `::` since GitHub Actions uses this as a
separator for different fields between a workflow command.

Let's also make sure `metadata` never ends in a `:` to avoid confusing
the GitHub Actions command parser about where the `::` separator is
meant to be.
2024-09-08 17:56:04 +08:00
Sam Ford
c2f0bacec8
Curl#curl_headers: Work with 56 exit_status
I previously added the 8 curl exit code (weird server reply) to the
list of non-success exit codes that `#curl_headers` will handle.
We're now seeing failures with a 56 exit code (failure in receiving
network data), where the server returns a 4xx response for a `HEAD`
request but the same request using `GET` works as expected (e.g.,
casks like `beeper`, `get-api`, `odrive`, `ui`, etc.).

This adds 56 to the list of exit codes in `#curl_headers`, so a
response with a 4xx HTTP status will be automatically retried using
`GET`.
2024-09-07 10:25:47 -04:00
Markus Reiter
9fd4c97fac
Add method for moving cursor up and to the beginning. 2024-09-04 22:54:29 +02:00
Markus Reiter
984cde114a
Move escape codes to Tty. 2024-09-04 22:54:28 +02:00
Markus Reiter
0cafa83f8a
Simplify Tty methods. 2024-09-04 22:54:26 +02:00
Markus Reiter
a114575663
Fix wrong terminal size. 2024-09-04 22:54:25 +02:00
Markus Reiter
6434533ff5
Remove Whirly and show concurrent downloads. 2024-09-04 22:54:24 +02:00
Bo Anderson
176ec0c6aa
utils/github: use x-access-token 2024-09-04 06:14:32 +01:00
Bo Anderson
e4896f3440
list.sh: support column output 2024-09-03 04:11:29 +01:00
Carlo Cabrera
cd5cf4e2c8
Merge pull request #18214 from Homebrew/audit-result-keyword 2024-09-02 16:14:30 +08:00
Carlo Cabrera
c73d08c75b
Update comment re #nil? vs #blank? 2024-09-02 16:02:35 +08:00
Adam Blazczak
245c93785a Fix SyntaxError introduced by a refactor in bc0f5ee
$ brew update
==> Updating Homebrew...
To restore the stashed changes to /usr/local/Homebrew, run:
  cd /usr/local/Homebrew && git stash pop
  File "<string>", line 1
    import fcntl; fcntl.flock(, fcntl.LOCK_EX | fcntl.LOCK_NB)
                              ^
SyntaxError: invalid syntax

Introduced on May 2, 2024 with bc0f5ee62a
2024-09-01 10:40:23 -07:00
Carlo Cabrera
654a58237e
formula: make audit_result a kwarg in inreplace
This allows us to get rid of a RuboCop disable, and will make formulae
easier to read.
2024-09-01 05:05:13 +08:00
Sam Ford
24ac6967ba
Adjust typing around #check_pull_requests
`brew bump-formula-pr` is encountering a type error, as the inferred
return type of `GitHub#check_for_duplicate_pull_requests` doesn't
align with the explicit return type of `#check_pull_requests`:

```
Error: Return value: Expected type T.nilable(T::Array[String]), got
  type Module with value T::Private::Types::Void::VOID
Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/
  bump-formula-pr.rb:137
Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/
  dev-cmd/bump-formula-pr.rb:472 (Homebrew::DevCmd::BumpFormulaPr
  #check_pull_requests)
```

This addresses the issue by adding a type signature with a `void`
return type to `#check_for_duplicate_pull_requests` and setting the
return type of `#check_pull_requests` to `void` as well. The return
type from `#check_pull_requests` isn't used, so a `void` return type
is arguably a better reflection of the method's behavior. The
`#check_pull_requests` method in `BumpCaskPr` has a `void` return
type, so this change brings the `BumpFormulaPr` method in line.
2024-08-31 16:42:43 -04:00
Mike McQuaid
fe909c41b8
Improve duplicate pull request handling
- change the messaging depending on how confident we are that we're
  actually looking at duplicates i.e. we're not confident without a
  version number supplied
- similarly, just warn instead of failing with an error (and no
  override) if we're not confident that we're looking at duplicates
  because a version wasn't supplied
- change `bump-cask-pr` and `bump-formula-pr` to always check for all
  pull requests with the new version number (to allow failing on this)
  rather than only checking closed pull requests with a version number
- change `bump` to check for definite/maybe duplicate PRs and only
  exit if they are definitely duplicates
- cleanup some variable usage to DRY things up a bit
2024-08-30 14:21:42 +01:00
Carlo Cabrera
e3d295ae12
Merge pull request #18203 from Homebrew/sponsorships-error 2024-08-30 11:13:29 +08:00
Carlo Cabrera
ed589c0a19
Merge pull request #18202 from Homebrew/fix-sponsorships-query 2024-08-30 11:02:28 +08:00
Carlo Cabrera
c740bef176
utils/github: improve sponsorships error handling
Let's make sure we get the opportunity to print the errors if the query
response doesn't have the form we expected it to take.
2024-08-30 11:00:53 +08:00
Carlo Cabrera
5897ed80d9
utils/github: fix sponsorships GraphQL query
This fixes the failure in our sponsorships workflow.
2024-08-30 10:50:59 +08:00
Carlo Cabrera
cabbb0b8e3
Remove GraphQL debug output
Let's get this ready to go since we don't want to accidentally leak
private information.
2024-08-30 10:45:19 +08:00
Carlo Cabrera
7645484ac3
utils/github/api: add debug output for open_graphql
Our updating sponsors/maintainers/etc workflow is broken.

Let's add some debug output to help me fix it.
2024-08-30 10:15:56 +08:00
Michael Cho
06fc2247c7
Merge pull request #18178 from cho-m/github-tag
utils/shared_audits: GitHub urls can have '.' in repo and '/' in tag
2024-08-28 21:55:29 -04:00
Bo Anderson
6a0db5035f
Fix misuse of fork in sandbox causing crashes 2024-08-28 13:53:01 +01:00
Michael Cho
d1dc3b2206
utils/shared_audits: GitHub urls can have '.' in repo and '/' in tag 2024-08-27 11:39:50 -04:00
Mike McQuaid
81d26f8059
Merge pull request #18169 from cho-m/spdx-case-sensitive 2024-08-27 09:28:55 +01:00
Michael Cho
cccab0d9a9
utils/shared_audits: allow subgroups in gitlab url 2024-08-26 23:07:31 -04:00
Michael Cho
82fbbcc88b
utils/spdx: fix invalid SPDX syntax for symbols
Also use more common uppercase operators for backwards compatibility
2024-08-26 13:55:37 -04:00
Mike McQuaid
d58302ef6b
Merge pull request #18147 from Homebrew/shellcheck-helpers.sh 2024-08-26 09:17:24 +01:00