Skip to content

use Octokit client to download buildx#191

Merged
crazy-max merged 2 commits intodocker:masterfrom
crazy-max:fix-dl-release
Jan 28, 2023
Merged

use Octokit client to download buildx#191
crazy-max merged 2 commits intodocker:masterfrom
crazy-max:fix-dl-release

Conversation

@crazy-max
Copy link
Copy Markdown
Member

fixes #190

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit a024221 into docker:master Jan 28, 2023
@rmg
Copy link
Copy Markdown

rmg commented Jan 28, 2023

Using @actions/github for this will break GH enterprise usage because it would try to download the release from the GH enterprise server it is running on instead of github.com

@crazy-max
Copy link
Copy Markdown
Member Author

crazy-max commented Jan 28, 2023

@rmg So needs to enforce server url in octokit?

@crazy-max crazy-max deleted the fix-dl-release branch January 28, 2023 01:09
@crazy-max crazy-max restored the fix-dl-release branch January 28, 2023 01:09
@crazy-max
Copy link
Copy Markdown
Member Author

crazy-max commented Jan 28, 2023

@rmg You mean https://github.com/actions/toolkit/tree/main/packages/github#usage?:

Returns an authenticated Octokit client that follows the machine proxy settings and correctly sets GHES base urls. See https://octokit.github.io/rest.js for the API.

That doesn't look to be related

@rmg
Copy link
Copy Markdown

rmg commented Jan 28, 2023

Having it as an input is good, but making the default a little smarter would be good, eg: from actions/setup-go:action.yml:

  token:
    description: Used to pull node distributions from go-versions. 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 || '' }}

@rmg
Copy link
Copy Markdown

rmg commented Jan 28, 2023

@actions/github creates the client using process.env['GITHUB_API_URL'] which will be different on GHES.

@tonistiigi
Copy link
Copy Markdown
Member

@rmg Is there a place where we can hardcode it to api.github.com on initialization?

@crazy-max
Copy link
Copy Markdown
Member Author

crazy-max commented Jan 28, 2023

I think with:

      .getOctokit(githubToken, {
        baseUrl: config.GITHUB_API_URL
      })

@crazy-max
Copy link
Copy Markdown
Member Author

@rmg Ah yes just found actions/toolkit#449

@rmg
Copy link
Copy Markdown

rmg commented Jan 28, 2023

FWIW it took GitHub a few tries to get this right for their own actions: https://github.com/actions/setup-python/pulls?q=is%3Apr+token+is%3Aclosed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot find buildx v0.9.1 release

3 participants