Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for other GitHub API urls #47

Merged
merged 8 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://opensource.org/licenses/MIT> for details.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ async function run(): Promise<void> {
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);
Expand Down
Loading