Not using "token" on github server
See original GitHub issueDescribe 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
ormaster
)
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:
- Run github actions with
actions/setup-python@v2
on github server a lot - 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:
- Created 2 years ago
- Reactions:7
- Comments:15 (13 by maintainers)
Top GitHub Comments
Thanks! I’ve updated my previous comments with the full SHA.
If you’d like to add anything that tripped you up to our docs for GHES, that would be very helpful!
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.
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.