style: fix prettier formatting

This commit is contained in:
Salman Chishti 2026-04-08 21:46:34 +00:00 committed by GitHub
parent 7ece71c49e
commit 599b1f4052
2 changed files with 19 additions and 11 deletions

View file

@ -192,7 +192,11 @@ describe('createConfiguredGetOctokit', () => {
wrapped('tok' as any, {request: {retries: undefined, timeout: 5000}} as any) wrapped('tok' as any, {request: {retries: undefined, timeout: 5000}} as any)
const calledOpts = raw.mock.calls[0][1] const calledOpts = raw.mock.calls[0][1]
expect(calledOpts.request).toEqual({retries: 3, agent: 'proxy', timeout: 5000}) expect(calledOpts.request).toEqual({
retries: 3,
agent: 'proxy',
timeout: 5000
})
}) })
test('undefined values in nested retry are stripped', () => { test('undefined values in nested retry are stripped', () => {
@ -230,7 +234,10 @@ describe('createConfiguredGetOctokit', () => {
const originalDefaults = JSON.parse(JSON.stringify(defaults)) const originalDefaults = JSON.parse(JSON.stringify(defaults))
const wrapped = createConfiguredGetOctokit(raw as any, defaults) const wrapped = createConfiguredGetOctokit(raw as any, defaults)
wrapped('tok' as any, {request: {timeout: 5000}, retry: {retries: 10}} as any) wrapped(
'tok' as any,
{request: {timeout: 5000}, retry: {retries: 10}} as any
)
wrapped('tok' as any, {request: {timeout: 9000}} as any) wrapped('tok' as any, {request: {timeout: 9000}} as any)
expect(defaults).toEqual(originalDefaults) expect(defaults).toEqual(originalDefaults)
@ -241,12 +248,15 @@ describe('createConfiguredGetOctokit', () => {
const defaults = {baseUrl: 'https://ghes.example.com/api/v3'} const defaults = {baseUrl: 'https://ghes.example.com/api/v3'}
const wrapped = createConfiguredGetOctokit(raw as any, defaults) const wrapped = createConfiguredGetOctokit(raw as any, defaults)
wrapped('tok' as any, { wrapped(
log: null, 'tok' as any,
retries: 0, {
debug: false, log: null,
userAgent: '' retries: 0,
} as any) debug: false,
userAgent: ''
} as any
)
const calledOpts = raw.mock.calls[0][1] const calledOpts = raw.mock.calls[0][1]
expect(calledOpts.log).toBeNull() expect(calledOpts.log).toBeNull()

View file

@ -4,9 +4,7 @@ import {getOctokit} from '@actions/github'
* Strip keys whose value is `undefined` so they don't clobber defaults * Strip keys whose value is `undefined` so they don't clobber defaults
* during object spread (e.g. `{baseUrl: undefined}` would wipe a GHES URL). * during object spread (e.g. `{baseUrl: undefined}` would wipe a GHES URL).
*/ */
function stripUndefined( function stripUndefined(obj: Record<string, unknown>): Record<string, unknown> {
obj: Record<string, unknown>
): Record<string, unknown> {
return Object.fromEntries( return Object.fromEntries(
Object.entries(obj).filter(([, v]) => v !== undefined) Object.entries(obj).filter(([, v]) => v !== undefined)
) )