Skip to content

Commit 5c62399

Browse files
authored
feat: add option to override base url for GHES (#104)
Co-authored-by: Adam Letizia <letiziaadam@johndeere.com>
1 parent d8139a2 commit 5c62399

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Options:
2323
--octoherd-debug Show debug logs [boolean] [default: false]
2424
--octoherd-bypass-confirms Bypass prompts to confirm mutating requests
2525
[boolean] [default: false]
26+
--octoherd-base-url When using with GitHub Enterprise Server, set to the root URL
27+
of the API. For example, if your GitHub Enterprise Server's h
28+
ostname is github.acme-inc.com, then set to https://github.ac
29+
me-inc.com/api/v3. [string]
2630
--version Show version number [boolean]
2731
2832
Examples:
@@ -35,6 +39,9 @@ Examples:
3539
octoherd/cli --octoherd-bypass-confirms
3640
octoherd run -S path/to/script.js -T $TOKEN -R Will fetch all repositories except repo-owner/hello-world
3741
'repo-owner/*' -R '!repo-owner/hello-world
42+
octoherd run -S path/to/script.js Run octoherd script against GHES
43+
--octoherd-base-url
44+
https://github.acme-inc.com/api/v3
3845
```
3946

4047
The `script` must export a `script` function which takes three parameters:

bin/commands/run.js

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ const options = {
4646
type: "boolean",
4747
default: false,
4848
},
49+
"octoherd-base-url": {
50+
description: "When using with GitHub Enterprise Server, set to the root URL of the API. For example, if your GitHub Enterprise Server's hostname is github.acme-inc.com, then set to https://github.acme-inc.com/api/v3.",
51+
type: "string",
52+
}
4953
};
5054

5155
/** @type import('yargs').CommandModule */
@@ -70,6 +74,10 @@ const runCommand = {
7074
"octoherd run -S path/to/script.js -T $TOKEN -R octoherd/cli --octoherd-bypass-confirms",
7175
"Avoid any prompts",
7276
],
77+
[
78+
"octoherd run -S path/to/script.js --octoherd-base-url https://github.acme-inc.com/api/v3",
79+
"Run octoherd script against GHES",
80+
],
7381
])
7482
.options(options)
7583
.version(VERSIONS)

index.js

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export async function octoherd(options) {
3232
octoherdScript,
3333
octoherdRepos,
3434
octoherdBypassConfirms,
35+
octoherdBaseUrl,
3536
...userOptions
3637
} = options;
3738

@@ -74,6 +75,7 @@ export async function octoherd(options) {
7475
const octokit = new CliOctokit({
7576
...authOptions,
7677
userAgent: ["octoherd-cli", VERSION].join("/"),
78+
baseUrl: octoherdBaseUrl,
7779
octoherd: {
7880
cache: octoherdCache,
7981
bypassConfirms: octoherdBypassConfirms,

0 commit comments

Comments
 (0)