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

HOMEBREW_GITHUB_API_TOKEN doesn't apply for call to https://api.github.com/repos/org/name/releases/latest #17272

Closed
3 tasks done
owenthereal opened this issue May 10, 2024 · 2 comments · Fixed by pgxman/pgxman#193
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@owenthereal
Copy link

owenthereal commented May 10, 2024

brew doctor output

N/A

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

N/A

What were you trying to do (and why)?

I'm trying to run a test in GitHub Actions for installing a local brew formula: brew install PATH_TO_FORMULA. The formula points to a local file for release:

# typed: false
# frozen_string_literal: true

# This file was generated by GoReleaser. DO NOT EDIT.
class Pgxman < Formula
  desc "PostgreSQL Extensions Manager"
  homepage "https://github.com/pgxman/pgxman"
  version "1.2.4-snapshot"
  license "Apache 2.0"

  on_macos do
    if Hardware::CPU.intel?
      url "file:///Users/owen/code/src/github.com/HydrasCo/pgxman/dist/pgxman_darwin_amd64.tar.gz"
      sha256 "fd0204385a1c7ce67c3b2f0c9cd484d6c2c5cf233004957f282c0fbb291cd9a1"

      def install
        bin.install "bin/pgxman"
        man1.install Dir["docs/man/man1/pgxman*.1"]
        generate_completions_from_executable(bin/"pgxman", "completion")
      end
    end
    if Hardware::CPU.arm?
      url "file:///Users/owen/code/src/github.com/HydrasCo/pgxman/dist/pgxman_darwin_arm64.tar.gz"
      sha256 "9af0150120246aeff300f08180580af32a530d0fe233293c8268d87e482bb273"

      def install
        bin.install "bin/pgxman"
        man1.install Dir["docs/man/man1/pgxman*.1"]
        generate_completions_from_executable(bin/"pgxman", "completion")
      end
    end
  end

  on_linux do
    if Hardware::CPU.intel?
      url "file:///Users/owen/code/src/github.com/HydrasCo/pgxman/dist/pgxman_linux_amd64.tar.gz"
      sha256 "8c63728b2a297ad31ac6fe3fe7868dccb717cd4bec01a8fe26e818d20ed90d7a"

      def install
        bin.install "bin/pgxman"
        man1.install Dir["docs/man/man1/pgxman*.1"]
        generate_completions_from_executable(bin/"pgxman", "completion")
      end
    end
    if Hardware::CPU.arm? && !Hardware::CPU.is_64_bit?
      url "file:///Users/owen/code/src/github.com/HydrasCo/pgxman/dist/pgxman_linux_armv6.tar.gz"
      sha256 "0c6d650ca0a505569f33e8b551695f798d57ac4e32e718ba723f3816742344f5"

      def install
        bin.install "bin/pgxman"
        man1.install Dir["docs/man/man1/pgxman*.1"]
        generate_completions_from_executable(bin/"pgxman", "completion")
      end
    end
    if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
      url "file:///Users/owen/code/src/github.com/HydrasCo/pgxman/dist/pgxman_linux_arm64.tar.gz"
      sha256 "ecf384379d7de3e2f24d45474b5b5a8df728fd8aa755ad0ca8d99c7799d61584"

      def install
        bin.install "bin/pgxman"
        man1.install Dir["docs/man/man1/pgxman*.1"]
        generate_completions_from_executable(bin/"pgxman", "completion")
      end
    end
  end

  head "https://github.com/pgxman/pgxman.git"

  test do
    assert_match(/pgxman version/, shell_output("#{bin}/pgxman --version"))
  end
end

What happened (include all command output)?

The GitHub Aciton fails for GET https://api.github.com/repos/org/name/releases/latest: 403 API rate limit exceeded 403 (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details. even if I have set HOMEBREW_GITHUB_API_TOKEN to authenticate with GitHub.

What did you expect to happen?

HOMEBREW_GITHUB_API_TOKEN will be used to authenticate with GitHub for any API calls, and I won't run into GitHub API rate limit errors.

Besides, why would GET https://api.github.com/repos/org/name/releases/latest (checking the latest release) be called while I install a local formula that points to a local file for release?

Step-by-step reproduction instructions (by running brew commands)

Create a GitHub Actions workflow with the following:

  • HOMEBREW_GITHUB_API_TOKEN is set to a valid token
  • Install a local formula brew installs PATH_TO_FORMULA

If the Action worker's IP is rate limited, the workflow will fail for the 403 API rate limit exceeded for 13.105.117.46. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details. error.

An example workflow result is here: https://github.com/pgxman/pgxman/actions/runs/9036106788/job/24832321215#step:4:79

@owenthereal owenthereal added the bug Reproducible Homebrew/brew bug label May 10, 2024
@Bo98
Copy link
Member

Bo98 commented May 10, 2024

It seems to be failing when running pgxman completion bash. Is it not your auto-update checker?

@owenthereal
Copy link
Author

owenthereal commented May 10, 2024

@Bo98:

Is it not your auto-update checker?

Indeed! That's what failed. I was confused. Thanks for the help!

@github-actions github-actions bot added the outdated PR was locked due to age label Jun 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants