Skip to content

Commit 19ac6e4

Browse files
committed
feat: wire getOctokit factory into script context
1 parent 0c2c53e commit 19ac6e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {requestLog} from '@octokit/plugin-request-log'
88
import {retry} from '@octokit/plugin-retry'
99
import {RequestRequestOptions} from '@octokit/types'
1010
import {callAsyncFunction} from './async-function'
11+
import {createConfiguredGetOctokit} from './create-configured-getoctokit'
1112
import {RetryOptions, getRetryOptions, parseNumberArray} from './retry-options'
1213
import {wrapRequire} from './wrap-require'
1314

@@ -59,13 +60,24 @@ async function main(): Promise<void> {
5960
const github = getOctokit(token, opts, retry, requestLog)
6061
const script = core.getInput('script', {required: true})
6162

63+
// Wrap getOctokit so secondary clients inherit retry, logging,
64+
// orchestration ID, and the action's retries input.
65+
// Deep-copy opts to prevent shared references with the primary client.
66+
const configuredGetOctokit = createConfiguredGetOctokit(
67+
getOctokit,
68+
{...opts, retry: {...opts.retry}, request: {...opts.request}},
69+
retry,
70+
requestLog
71+
)
72+
6273
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
6374
const result = await callAsyncFunction(
6475
{
6576
require: wrapRequire,
6677
__original_require__: __non_webpack_require__,
6778
github,
6879
octokit: github,
80+
getOctokit: configuredGetOctokit,
6981
context,
7082
core,
7183
exec,

0 commit comments

Comments
 (0)