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

Unable to use built-in GitHub Token for avoiding rate limit issues on GHES #683

Closed
2 tasks done
mzwiesler opened this issue Jun 14, 2023 · 3 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@mzwiesler
Copy link

Description:
For our enterprise we are facing "API rate limit exceeded ..." errors. I read the documentation how to avoid rate limit issues but for our enterprise using PAT is not feasible. I would like to use the GITHUB-TOKEN for authentication in my Github Workflow since this is the recommended way from GitHub. However, this is not possible at the moment resulting in a Bad Credentials error.

It seems that the AUTH variable variable is not usable in this case since only personal tokens are authenticated with Authorization: token <TOKEN> but for GITHUB-TOKEN one needs to use Authorization: <GITHUB_TOKEN> instead as can be seen in the workflow below in step read limit.

Action version:
4.6.1

Platform:

  • Ubuntu

Runner type:

  • Self-hosted

Tools version:

All

Repro steps:

On GHES, following this example I used the following workflow:

name: CI With GitHub Token

on: [workflow_dispatch]

jobs:
  sample_build:
    runs-on: [azure-runners]
    steps:
      - name: "rate limit"
        run: |
          curl \
            -H "Accept: application/vnd.github.v3+json" \
            -H "Authorization: $TOKEN" \
            https://api.github.com/rate_limit
        env:
          TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Clear the tool cache
        run: rm -rf /Users/runner/hostedtoolcache/Python/

      - name: Set up Python
        uses: actions/setup-python@v4.6.1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          python-version: 3.9.12

      - name: "rate limit"
        run: |
          curl \
            -H "Accept: application/vnd.github.v3+json" \
            -H "Authorization: $TOKEN" \
            https://api.github.com/rate_limit
        env:
          TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expected behavior:
Installation of python version 3.9.12 and drop of rate limits from 60 to 58.

Actual behavior:
Failure with error Bad Credentials.
image

@mzwiesler mzwiesler added bug Something isn't working needs triage labels Jun 14, 2023
@dmitry-shibanov
Copy link
Contributor

Hello @mzwiesler. Thank you for your report. I think it is an expected behaviour. Could you please take a look at these:

@mzwiesler
Copy link
Author

@dmitry-shibanov Yes you are correct. Thank you for the links and your assistance.

@priya-kinthali
Copy link
Contributor

Hello @mzwiesler ,
Could you kindly verify if the issue related to the rate limit "API rate limit exceeded ..." has been resolved and confirm that no other issues have emerged while using the setup-actions-demo/setup-python@main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants