diff --git a/README.md b/README.md index de60544..f4f395c 100644 --- a/README.md +++ b/README.md @@ -31,5 +31,23 @@ If not specified the root job folder will be used. A boolean value to allow external github orgs in the foreman manifest file. If not specified, external github orgs will not be allowed. + +#### `github-api-url` (optional) +Override for the GitHub API URL. By default GitHub Actions will supply this +value as the current environment, which will usually be +`https://api.github.com`. + +This parameter exists primarily to allow GitHub Enterprise to point back to +GitHub Cloud to install publicly hosted tools. + +As such, for any use of this action in GitHub Enterprise, `github-api-url` +should be included like so: +```yaml +- uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + github-api-url: "https://api.github.com" +``` + ## License setup-foreman is available under the MIT license. See [LICENSE.txt](LICENSE.txt) or for details. diff --git a/action.yml b/action.yml index 00860c3..9165bde 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,9 @@ inputs: working-directory: required: false description: 'Working directory to run `foreman install` in' + github-api-url: + required: false + description: 'GitHub API to make requests to' token: required: true description: 'GitHub token from secrets.GITHUB_TOKEN' diff --git a/src/main.ts b/src/main.ts index d4de7a7..a1d0461 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,13 +11,16 @@ async function run(): Promise { const versionReq: string = getInput("version"); const githubToken: string = getInput("token"); const workingDir: string = getInput("working-directory"); + const githubApiUrl: string = getInput("github-api-url"); const allowExternalGithubOrgs: string = getInput( "allow-external-github-orgs" ).toLowerCase(); - const octokit = new GitHub(githubToken); + const octokit = new GitHub(githubToken, { + baseUrl: githubApiUrl + }); const releases = await foreman.getReleases(octokit); - const validReleases = foreman.filterValidReleases(releases) + const validReleases = foreman.filterValidReleases(releases); debug("Choosing release from GitHub API"); const release = foreman.chooseRelease(versionReq, validReleases);