Search code examples
iosgithub-actionscarthage

`carthage bootstrap` command results in `API rate limit exceeded` error in Github Actions workflow


I just moved my Xcode project to use Carthage instead of CocoaPods as my dependency manager, so I am trying to update my GitHub Actions CI workflow to download the dependency binaries.

However, after running carthage bootstrap --platform iOS --use-xcframeworks in my workflow, it eventually gives the output and error:

*** Cloning realm-cocoa
*** Skipped downloading realm-cocoa binary due to the error:
    "API rate limit exceeded for 199.19.85.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"

How do I resolve this error?


Solution

  • I figured it out! It turns out you need to specify the GITHUB_TOKEN as an environment variable when running the carthage bootstrap command. Here's the updated step in my workflow:

    - name: Download Carthage dependencies
      env:
        GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: carthage bootstrap --platform iOS --use-xcframeworks
    

    For reference, this Carthage issue and pull request helped lead me to the answer.

    Update Feb 1, 2023:

    Even with the above solution, I still often get the API rate limit exceeded error. It's just random whether it occurs or not. Still haven't figured out a bulletproof solution.