Giter VIP home page Giter VIP logo

generate_third_party's Issues

Handle rate limiting errors from GitHub API

Now that we added proper debug logging for calls to the GitHub API in #14, we can see that the 403 errors that curl was reporting are in fact rate limiting errors:

  Error during processing: OpenURI::HTTPError: 403 rate limit exceeded
Backtrace
  Backtrace:
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:364:in `open_http'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:741:in `buffer_open'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:212:in `block in open_loop'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:210:in `catch'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:210:in `open_loop'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:151:in `open_uri'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0/open-uri.rb:721:in `open'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/bin/install-cargo-about:69:in `block (2 levels) in <top (required)>'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/bin/install-cargo-about:37:in `retry_with'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/bin/install-cargo-about:68:in `block in <top (required)>'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/bin/install-cargo-about:29:in `log_group'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/bin/install-cargo-about:65:in `<top (required)>'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/vendor/bundle/ruby/3.1.0/bin/install-cargo-about:25:in `load'
  	/Users/runner/work/_actions/artichoke/generate_third_party/trunk/vendor/bundle/ruby/3.1.0/bin/install-cargo-about:25:in `<top (required)>'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli/exec.rb:58:in `load'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli/exec.rb:58:in `kernel_load'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli/exec.rb:23:in `run'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli.rb:484:in `exec'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli.rb:31:in `dispatch'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/cli.rb:25:in `start'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/exe/bundle:48:in `block in <top (required)>'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/exe/bundle:36:in `<top (required)>'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:25:in `load'
  	/Users/runner/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:25:in `<main>'
  Retrying ...

It looks like the GitHub API returns information about rate limits in the response: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#schema

$ curl -I https://api.github.com/users/octocat/orgs

> HTTP/2 200
> Server: nginx
> Date: Fri, 12 Oct 2012 23:33:14 GMT
> Content-Type: application/json; charset=utf-8
> ETag: "a00049ba79152d03380c34652f2cb612"
> X-GitHub-Media-Type: github.v3
> x-ratelimit-limit: 5000
> x-ratelimit-remaining: 4987
> x-ratelimit-reset: 1350085394
> Content-Length: 5
> Cache-Control: max-age=0, private, must-revalidate
> X-Content-Type-Options: nosniff

Additionally, it looks like we're calling the releases API unauthenticated. We can pass the GitHub token through in an Authorization header to get an isolated rate limit quota: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#example-2-calling-the-rest-api

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.