question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not using "token" on github server

See original GitHub issue

Describe the bug

Hi I am using actions/setup-python on a private github server. When I run curl https://api.github.com/rate_limit in the self-hosted runner I have 60 remaining resources. When I run the curl command again after uses: actions/setup-python I see that the resource counter goes down to 58. Since I am running this action a lot I eventually exceed my api call limit.

I tried using the key token under the with section with a token I created from github cloud but that did not work. I saw that when we are running on github server we are setting the AUTH variable to undefined. Link to code.

I know we are using ${{ github.token }} by default from the actions.yml file. So I believe the check for github server was added so that tokens from the private github server don’t get sent to github cloud. Could we add a second input for the token so that people running on private github servers don’t run into the api call limit error? Or if we detect that we are running on a private github server, could we try to use actions/python-versions on the github server instead?

Which version of the action are you using?

  • v1
  • v2
  • Some other tag (such as v2.0.1 or master)

Environment

  • [ x ] self-hosted
  • Linux
  • Windows
  • Mac

If applicable, please specify if you’re using a container

Python Versions

  • 3.8
  • 3.9

To Reproduce Steps to reproduce the behavior:

  1. Run github actions with actions/setup-python@v2 on github server a lot
  2. Then we run into Error: API rate limit exceeded for <IP address>. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

github actions yaml file:

name: CI

on:
  push:
    branches: [ master ]

jobs:
  sample_build:
    runs-on: [ self-hosted ]
    steps:
      - name: "rate limit"
        run: |
          curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/rate_limit

      - name: Set up Python 3.9
        uses: actions/setup-python@v2
        with:
          token: ${{ secrets.GH_CLOUD_TOKEN }}
          python-version: 3.9

      - name: "rate limit"
        run: |
          curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/rate_limit

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
brcristacommented, Sep 27, 2022

Thanks! I’ve updated my previous comments with the full SHA.

I will write a separate post-mortem post for anyone stumbling upon this at a later time.

If you’d like to add anything that tripped you up to our docs for GHES, that would be very helpful!

1reaction
kasuterucommented, Sep 27, 2022

Thank you for the reply. I didn’t realize v4 didn’t have it yet - that explains it.

With your help, I was able to verify that caching indeed usually works, but not always, and when it doesn’t work, it almost always runs into the rate limit. I suspect this is because our company has a lot of runners hidden behind the same IP.

When trying to use your version, the following error came up - looks like one needs to always specify the full version.

image

After specifying the full hash, I was able to confirm that it now works! Thank you!

I will write a separate post-mortem post for anyone stumbling upon this at a later time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a personal access token - GitHub Docs
Using a token on the command line​​ Personal access tokens can only be used for HTTPS Git operations. If your repository uses an...
Read more >
Creating a personal access token - GitHub Docs
Personal access token are an alternative to using passwords for authentication to GitHub Enterprise Server when using the GitHub API or the command...
Read more >
Automatic token authentication - GitHub Docs
The GITHUB_TOKEN secret is a GitHub App installation access token. You can use the installation access token to authenticate on behalf of the...
Read more >
Automatic token authentication - GitHub Enterprise Server 3.3 ...
The GITHUB_TOKEN secret is a GitHub App installation access token. You can use the installation access token to authenticate on behalf of the...
Read more >
Refreshing user-to-server access tokens - GitHub Docs
If you want your app to use non-expiring user-to-server access tokens, you can deselect "Expire user authorization tokens" on the app settings page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found