- Notifications
You must be signed in to change notification settings - Fork 667
Only use github.token on github.com #443
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
Conversation
This expression evaluates to `''` if called from GHES hosted elsewhere You can still provide your token on both github.com and GHES
| Thanks for the suggestion! Let me try testing this against a GHES instance with #437 re-enabled. |
| Tested on a GHES instance (3.6.0) with this workflow: name: CI on: [workflow_dispatch] jobs: sample_build: runs-on: [ self-hosted ] steps: - name: "rate limit" run: | curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token $TOKEN" \ https://api.github.com/rate_limit env: TOKEN: ${{ secrets.GH_DOTCOM_TOKEN }} - name: Clear the tool cache run: rm -rf /Users/runner/hostedtoolcache/Python/ - name: Set up Python uses: brcrista/setup-python@patch-1 with: token: ${{ secrets.GH_DOTCOM_TOKEN }} python-version: 3.9.12 - name: "rate limit" run: | curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token $TOKEN" \ https://api.github.com/rate_limit env: TOKEN: ${{ secrets.GH_DOTCOM_TOKEN }}Confirmed that:
|
| Also regression-tested the default case on github.com and made sure the download still works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is passing now; must have been an issue with one of the hosted images.
Thanks @ChristopherHX for your contribution!
* Only use github.token on github.com This expression evaluates to `''` if called from GHES hosted elsewhere You can still provide your token on both github.com and GHES * Enshure blank result of expression and not false * Revert "Revert "Pass the `token` input through on GHES (actions#427)" (actions#437)" This reverts commit f05e25d. * fix typo * Add back the doc on the tool cache for self-hosted Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
Description:
This expression
${{ github.server_url == 'https://github.com' && github.token || '' }}evaluates to''if called from GHES hosted elsewhereYou can still provide your token on both github.com and GHES
See docu https://docs.github.com/en/actions/learn-github-actions/contexts.
Related issue:
Needs PullRequest: #427
#229, without the need for a new input or breaking using the token input on GHES.
Check list: