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 2e93fc7..fa39634 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 8afe086..a479449 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 artifactoryUrl = getInput("artifactory-url"); const artifactoryToken = getInput("artifactory-token"); - const octokit = new GitHub(githubToken); + const octokit = new GitHub(githubToken, { + baseUrl: githubApiUrl + }); const releases = await foreman.getReleases(octokit); const validReleases = foreman.filterValidReleases(releases); debug("Choosing release from GitHub API");