From ea121b86f93250013496c8ae6b1852ce432aed23 Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Fri, 20 Oct 2023 10:16:28 -0600 Subject: [PATCH 1/4] add base-url option --- action.yml | 3 +++ src/main.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 858c88f5..742549b3 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,9 @@ inputs: retry-exempt-status-codes: description: A comma separated list of status codes that will NOT be retried e.g. "400,500". No effect unless `retries` is set default: 400,401,403,404,422 # from https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14 + base-url: + description: The root of the API URL of the GHES instance to which to connect. + required: false outputs: result: description: The return value of the script, stringified with `JSON.stringify` diff --git a/src/main.ts b/src/main.ts index 658cee06..f3c41b08 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,7 @@ main().catch(handleError) type Options = { log?: Console userAgent?: string + baseUrl?: string previews?: string[] retry?: RetryOptions request?: RequestRequestOptions @@ -28,6 +29,7 @@ async function main(): Promise { const debug = core.getBooleanInput('debug') const userAgent = core.getInput('user-agent') const previews = core.getInput('previews') + const baseUrl = core.getInput('base-url') const retries = parseInt(core.getInput('retries')) const exemptStatusCodes = parseNumberArray( core.getInput('retry-exempt-status-codes') @@ -43,7 +45,8 @@ async function main(): Promise { userAgent: userAgent || undefined, previews: previews ? previews.split(',') : undefined, retry: retryOpts, - request: requestOpts + request: requestOpts, + baseUrl: baseUrl || undefined } const github = getOctokit(token, opts, retry, requestLog) From e8957ff5ee76db74d98a47fa052d129482ee87a1 Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Mon, 23 Oct 2023 16:35:17 -0600 Subject: [PATCH 2/4] generate dist changes for addition of base-url --- dist/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 5eb9aacf..3d30c49a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -15220,6 +15220,7 @@ async function main() { const debug = core.getBooleanInput('debug'); const userAgent = core.getInput('user-agent'); const previews = core.getInput('previews'); + const baseUrl = core.getInput('base-url'); const retries = parseInt(core.getInput('retries')); const exemptStatusCodes = parseNumberArray(core.getInput('retry-exempt-status-codes')); const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes, utils.defaults); @@ -15228,7 +15229,8 @@ async function main() { userAgent: userAgent || undefined, previews: previews ? previews.split(',') : undefined, retry: retryOpts, - request: requestOpts + request: requestOpts, + baseUrl: baseUrl || undefined }; const github = (0,lib_github.getOctokit)(token, opts, plugin_retry_dist_node/* retry */.XD, dist_node/* requestLog */.g); const script = core.getInput('script', { required: true }); From ef8023aa4abe571b1300d698453c06ce31edceb0 Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Mon, 23 Oct 2023 19:35:20 -0400 Subject: [PATCH 3/4] Update action.yml Co-authored-by: Josh Gross --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 742549b3..373b1766 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,7 @@ inputs: description: A comma separated list of status codes that will NOT be retried e.g. "400,500". No effect unless `retries` is set default: 400,401,403,404,422 # from https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14 base-url: - description: The root of the API URL of the GHES instance to which to connect. + description: An optional GitHub REST API URL to connect to a different GitHub instance. required: false outputs: result: From 5940a763782c6e1af9993f61930458ed8e5e4b1d Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Mon, 23 Oct 2023 17:37:49 -0600 Subject: [PATCH 4/4] add example to description of base-url parameter --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 373b1766..39615fd4 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,7 @@ inputs: description: A comma separated list of status codes that will NOT be retried e.g. "400,500". No effect unless `retries` is set default: 400,401,403,404,422 # from https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14 base-url: - description: An optional GitHub REST API URL to connect to a different GitHub instance. + description: An optional GitHub REST API URL to connect to a different GitHub instance. For example, https://my.github-enterprise-server.com/api/v3 required: false outputs: result: