Skip to content

Commit cc0a2bb

Browse files
authored
Add support for GitHub Enterprise (#152)
* use GITHUB_API_URL env var to support usage with GitHub Enterprise * stringify github api error objects * update lib * test correct endpoint * fix endpoint usage * reset quotes
1 parent b617986 commit cc0a2bb

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ let configSource!: 'list' | 'repo'
5050
startGroup('Syncing labels...')
5151
const options: Options = {
5252
accessToken: getInput('token'),
53+
endpoint: process.env.GITHUB_API_URL?.replace(/^https?:\/\//, ''),
5354
repo: process.env.GITHUB_REPOSITORY as string,
5455
labels,
55-
5656
allowAddedLabels: getInput('delete-other-labels') != 'true',
5757
dryRun: getInput('dry-run') == 'true'
5858
}
@@ -85,7 +85,7 @@ let configSource!: 'list' | 'repo'
8585
core.info(msg.join('\n'))
8686
endGroup()
8787
} catch (e: any) {
88-
log.fatal(e)
88+
log.fatal(JSON.stringify(e))
8989
}
9090
})()
9191

@@ -230,7 +230,7 @@ async function fetchRepoLabels(
230230
): Promise<LabelInfo[]> {
231231
startGroup('Getting repo labels...')
232232

233-
const url = `https://api.github.com/repos/${repo}/labels`,
233+
const url = `${process.env.GITHUB_API_URL}/repos/${repo}/labels`,
234234
headers = token ? { Authorization: `token ${token}` } : undefined
235235
log.info(`Using following URL: ${url}`)
236236

0 commit comments

Comments
 (0)