Skip to content

Commit

Permalink
feat: 37 - add support for Github Enterprise (dsaltares#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsaltares committed May 8, 2022
1 parent b6341d4 commit f690f63
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Target file path. Only supports paths to subdirectories of the GitHub Actions wo

Boolean indicating if `file` is to be interpreted as regular expression. Defaults to `false`.

### `octokitBaseUrl`

The Github API base URL. Useful if you are using Github Enterprise.

## Outputs

### `version`
Expand Down
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
type: boolean
required: false
default: false
octokitBaseUrl:
description: 'The Github API base URL. Useful if you are using Github Enterprise.'
required: false
runs:
using: 'node16'
main: 'dist/index.js'
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12627,7 +12627,8 @@ var main = async () => {
const file = core.getInput("file", { required: true });
const usesRegex = core.getBooleanInput("regex", { required: false });
const target = inputTarget === "" ? file : inputTarget;
const octokit = github.getOctokit(token);
const baseUrl = core.getInput("octokitBaseUrl", { required: false }) || void 0;
const octokit = github.getOctokit(token, { baseUrl });
const release = await getRelease(octokit, { owner, repo, version });
const assetFilterFn = usesRegex ? filterByRegex(file) : filterByFileName(file);
const assets = release.data.assets.filter(assetFilterFn);
Expand Down
4 changes: 3 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ const main = async (): Promise<void> => {
const file = core.getInput('file', { required: true });
const usesRegex = core.getBooleanInput('regex', { required: false });
const target = inputTarget === '' ? file : inputTarget;
const baseUrl =
core.getInput('octokitBaseUrl', { required: false }) || undefined;

const octokit = github.getOctokit(token);
const octokit = github.getOctokit(token, { baseUrl });
const release = await getRelease(octokit, { owner, repo, version });

const assetFilterFn = usesRegex
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
Expand Down

0 comments on commit f690f63

Please sign in to comment.