mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 05:50:31 +00:00
feat: pass github token for mise calls (#205)
This commit is contained in:
parent
bb86feacf6
commit
d24e3836a6
5 changed files with 39 additions and 1 deletions
16
README.md
16
README.md
|
|
@ -31,6 +31,7 @@ jobs:
|
|||
shellcheck = "0.9.0"
|
||||
working_directory: app # [default: .] directory to run mise in
|
||||
reshim: false # [default: false] run `mise reshim --all`
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }} # [default: ${{ github.token }}] GitHub token for API authentication
|
||||
- run: shellcheck scripts/*.sh
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -41,6 +42,21 @@ jobs:
|
|||
- run: node ./my_app.js
|
||||
```
|
||||
|
||||
## GitHub API Rate Limits
|
||||
|
||||
When installing tools hosted on GitHub (like `gh`, `node`, `bun`, etc.), mise needs to make API calls to GitHub's releases API. Without authentication, these calls are subject to GitHub's rate limit of 60 requests per hour, which can cause installation failures.
|
||||
|
||||
```yaml
|
||||
- uses: jdx/mise-action@v2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# your other configuration
|
||||
```
|
||||
|
||||
**Note:** The action automatically uses `${{ github.token }}` as the default, so in most cases you don't need to explicitly provide it. However, if you encounter rate limit errors, make sure the token is being passed correctly.
|
||||
|
||||
## Alternative Installation
|
||||
|
||||
Alternatively, mise is easy to use in GitHub Actions even without this:
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ inputs:
|
|||
required: false
|
||||
default: "false"
|
||||
description: if true, will run `mise reshim --all` after setting up mise
|
||||
github_token:
|
||||
required: false
|
||||
description: |
|
||||
GitHub token for API authentication to avoid rate limits when installing GitHub-hosted tools.
|
||||
Defaults to the automatic GitHub token.
|
||||
default: ${{ github.token }}
|
||||
outputs:
|
||||
cache-hit:
|
||||
description: A boolean value to indicate if a cache was hit.
|
||||
|
|
|
|||
7
dist/index.js
generated
vendored
7
dist/index.js
generated
vendored
|
|
@ -66578,6 +66578,13 @@ async function setEnvVars() {
|
|||
const logLevel = core.getInput('log_level');
|
||||
if (logLevel)
|
||||
set('MISE_LOG_LEVEL', logLevel);
|
||||
const githubToken = core.getInput('github_token');
|
||||
if (githubToken) {
|
||||
set('GITHUB_TOKEN', githubToken);
|
||||
}
|
||||
else {
|
||||
core.warning('No GITHUB_TOKEN provided. You may hit GitHub API rate limits when installing tools from GitHub.');
|
||||
}
|
||||
set('MISE_TRUSTED_CONFIG_PATHS', process.cwd());
|
||||
set('MISE_YES', '1');
|
||||
const shimsDir = path.join(miseDir(), 'shims');
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -53,6 +53,15 @@ async function setEnvVars(): Promise<void> {
|
|||
const logLevel = core.getInput('log_level')
|
||||
if (logLevel) set('MISE_LOG_LEVEL', logLevel)
|
||||
|
||||
const githubToken = core.getInput('github_token')
|
||||
if (githubToken) {
|
||||
set('GITHUB_TOKEN', githubToken)
|
||||
} else {
|
||||
core.warning(
|
||||
'No GITHUB_TOKEN provided. You may hit GitHub API rate limits when installing tools from GitHub.'
|
||||
)
|
||||
}
|
||||
|
||||
set('MISE_TRUSTED_CONFIG_PATHS', process.cwd())
|
||||
set('MISE_YES', '1')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue