mirror of
https://github.com/docker/setup-buildx-action.git
synced 2024-11-15 15:33:52 +08:00
Merge pull request #192 from crazy-max/support-ghes
enforce baseUrl to api.github.com if action used on GHES
This commit is contained in:
commit
5e716dcfd6
30
README.md
30
README.md
@ -28,6 +28,7 @@ ___
|
|||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
* [`nodes` output](#nodes-output)
|
* [`nodes` output](#nodes-output)
|
||||||
* [BuildKit container logs](#buildkit-container-logs)
|
* [BuildKit container logs](#buildkit-container-logs)
|
||||||
|
* [Using on GHES](#using-on-ghes)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -174,6 +175,35 @@ The following [official docker environment variables](https://docs.docker.com/en
|
|||||||
|
|
||||||
See https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs
|
See https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs
|
||||||
|
|
||||||
|
## Using on GHES
|
||||||
|
|
||||||
|
GitHub Runners come [pre-installed with Docker Buildx](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md)
|
||||||
|
following your virtual environment. If you specify a version or `latest` of
|
||||||
|
Docker Buildx in your workflow, the version will be downloaded from [GitHub Releases in `docker/buildx`](https://github.com/docker/buildx/releases)
|
||||||
|
repository. These calls to `docker/buildx` are made via unauthenticated requests,
|
||||||
|
which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).
|
||||||
|
|
||||||
|
If more requests are made within the time frame, then you will start to see
|
||||||
|
rate-limit errors during downloading that looks like:
|
||||||
|
|
||||||
|
```
|
||||||
|
##[error]API rate limit exceeded for...
|
||||||
|
```
|
||||||
|
|
||||||
|
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new)
|
||||||
|
and pass it as the `github_token` input for the action:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
||||||
|
version: v0.10.1
|
||||||
|
```
|
||||||
|
|
||||||
|
If the runner is not able to access `github.com`, it will take the default one
|
||||||
|
available on the GitHub Runner or runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)"
|
||||||
|
for more information.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to contribute? Awesome! You can find information about contributing to
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
|
11
action.yml
11
action.yml
@ -45,9 +45,14 @@ inputs:
|
|||||||
description: 'Append additional nodes to the builder'
|
description: 'Append additional nodes to the builder'
|
||||||
required: false
|
required: false
|
||||||
github_token:
|
github_token:
|
||||||
description: 'The GitHub token used to create an authenticated client for GitHub API'
|
# https://github.com/actions/setup-go/blob/21459d0b7b1d63741429b748885bf5a4974593b4/action.yml#L12-L14
|
||||||
default: ${{ github.token }}
|
description: >
|
||||||
required: false
|
Used to verifiy the Git tag exists on docker/buildx repo. Since there's a
|
||||||
|
default, this is typically not supplied by the user. When running this
|
||||||
|
action on github.com, the default value is sufficient. When running on
|
||||||
|
GHES, you can pass a personal access token for github.com if you are
|
||||||
|
experiencing rate limiting.
|
||||||
|
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
name:
|
name:
|
||||||
|
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
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
@ -10,7 +10,9 @@ const [owner, repo] = 'docker/buildx'.split('/');
|
|||||||
export const getReleaseTag = async (tag: string, githubToken: string): Promise<Release> => {
|
export const getReleaseTag = async (tag: string, githubToken: string): Promise<Release> => {
|
||||||
return (
|
return (
|
||||||
await github
|
await github
|
||||||
.getOctokit(githubToken)
|
.getOctokit(githubToken, {
|
||||||
|
baseUrl: 'https://api.github.com'
|
||||||
|
})
|
||||||
.rest.repos.getReleaseByTag({
|
.rest.repos.getReleaseByTag({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@ -25,7 +27,9 @@ export const getReleaseTag = async (tag: string, githubToken: string): Promise<R
|
|||||||
export const getLatestRelease = async (githubToken: string): Promise<Release> => {
|
export const getLatestRelease = async (githubToken: string): Promise<Release> => {
|
||||||
return (
|
return (
|
||||||
await github
|
await github
|
||||||
.getOctokit(githubToken)
|
.getOctokit(githubToken, {
|
||||||
|
baseUrl: 'https://api.github.com'
|
||||||
|
})
|
||||||
.rest.repos.getLatestRelease({
|
.rest.repos.getLatestRelease({
|
||||||
owner,
|
owner,
|
||||||
repo
|
repo
|
||||||
|
Loading…
Reference in New Issue
Block a user