upgrade module to esm and update dependencies (#2463)

* upgrade module to esm so I can update dependencies

* fix ci failures
This commit is contained in:
Aiqiao Yan 2026-06-16 17:10:58 -04:00 committed by GitHub
parent 537c7ef99c
commit d914b262ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
57 changed files with 29147 additions and 23937 deletions

View File

@ -11,4 +11,5 @@ allowed:
- unlicense - unlicense
reviewed: reviewed:
npm: npm:
- "@actions/http-client" # MIT

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/content-type.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,46 @@
import * as core from '@actions/core' import {
jest,
describe,
it,
expect,
beforeAll,
beforeEach,
afterEach,
afterAll
} from '@jest/globals'
import * as fs from 'fs' import * as fs from 'fs'
import * as gitAuthHelper from '../lib/git-auth-helper'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import * as stateHelper from '../lib/state-helper' import {fileURLToPath} from 'url'
import {IGitCommandManager} from '../lib/git-command-manager'
import {IGitSourceSettings} from '../lib/git-source-settings' const __dirname = path.dirname(fileURLToPath(import.meta.url))
// Mock @actions/core before loading git-auth-helper
jest.unstable_mockModule('@actions/core', () => ({
setSecret: jest.fn(),
error: jest.fn(),
warning: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
setFailed: jest.fn()
}))
// Mock state-helper
jest.unstable_mockModule('../src/state-helper.js', () => ({
setSshKeyPath: jest.fn(),
setSshKnownHostsPath: jest.fn(),
IsPost: false,
RepositoryPath: ''
}))
// Dynamic imports after mocking
const core = await import('@actions/core')
const gitAuthHelper = await import('../src/git-auth-helper.js')
type IGitCommandManager =
import('../src/git-command-manager.js').IGitCommandManager
type IGitSourceSettings =
import('../src/git-source-settings.js').IGitSourceSettings
const isWindows = process.platform === 'win32' const isWindows = process.platform === 'win32'
const testWorkspace = path.join(__dirname, '_temp', 'git-auth-helper') const testWorkspace = path.join(__dirname, '_temp', 'git-auth-helper')
@ -32,25 +66,12 @@ describe('git-auth-helper tests', () => {
}) })
beforeEach(() => { beforeEach(() => {
// Mock setSecret jest.clearAllMocks()
jest.spyOn(core, 'setSecret').mockImplementation((secret: string) => {})
// Mock error/warning/info/debug
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
// Mock state helper
jest.spyOn(stateHelper, 'setSshKeyPath').mockImplementation(jest.fn())
jest
.spyOn(stateHelper, 'setSshKnownHostsPath')
.mockImplementation(jest.fn())
}) })
afterEach(() => { afterEach(() => {
// Unregister mocks // Unregister mocks
jest.restoreAllMocks() jest.clearAllMocks()
// Restore HOME // Restore HOME
if (originalHome) { if (originalHome) {
@ -229,7 +250,7 @@ describe('git-auth-helper tests', () => {
await authHelper.configureAuth() await authHelper.configureAuth()
// Assert secret // Assert secret
const setSecretSpy = core.setSecret as jest.Mock<any, any> const setSecretSpy = core.setSecret as jest.Mock<any>
expect(setSecretSpy).toHaveBeenCalledTimes(1) expect(setSecretSpy).toHaveBeenCalledTimes(1)
const expectedSecret = Buffer.from( const expectedSecret = Buffer.from(
`x-access-token:${settings.authToken}`, `x-access-token:${settings.authToken}`,
@ -529,7 +550,7 @@ describe('git-auth-helper tests', () => {
settings.sshKey = '' settings.sshKey = ''
const authHelper = gitAuthHelper.createAuthHelper(git, settings) const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth() await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any> const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any>
mockSubmoduleForeach.mockClear() // reset calls mockSubmoduleForeach.mockClear() // reset calls
// Act // Act
@ -562,7 +583,7 @@ describe('git-auth-helper tests', () => {
settings.persistCredentials = false settings.persistCredentials = false
const authHelper = gitAuthHelper.createAuthHelper(git, settings) const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth() await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any> const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any>
mockSubmoduleForeach.mockClear() // reset calls mockSubmoduleForeach.mockClear() // reset calls
// Act // Act
@ -588,7 +609,7 @@ describe('git-auth-helper tests', () => {
settings.sshKey = '' settings.sshKey = ''
const authHelper = gitAuthHelper.createAuthHelper(git, settings) const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth() await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any> const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any>
mockSubmoduleForeach.mockClear() // reset calls mockSubmoduleForeach.mockClear() // reset calls
// Act // Act
@ -627,7 +648,7 @@ describe('git-auth-helper tests', () => {
) )
const authHelper = gitAuthHelper.createAuthHelper(git, settings) const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth() await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any> const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any>
mockSubmoduleForeach.mockClear() // reset calls mockSubmoduleForeach.mockClear() // reset calls
// Act // Act
@ -809,7 +830,7 @@ describe('git-auth-helper tests', () => {
// Mock getSubmoduleConfigPaths to return our fake submodules (for both configure and remove) // Mock getSubmoduleConfigPaths to return our fake submodules (for both configure and remove)
const mockGetSubmoduleConfigPaths = const mockGetSubmoduleConfigPaths =
git.getSubmoduleConfigPaths as jest.Mock<any, any> git.getSubmoduleConfigPaths as jest.Mock<any>
mockGetSubmoduleConfigPaths.mockResolvedValue([ mockGetSubmoduleConfigPaths.mockResolvedValue([
submodule1ConfigPath, submodule1ConfigPath,
submodule2ConfigPath submodule2ConfigPath
@ -1147,7 +1168,7 @@ async function setup(testName: string): Promise<void> {
), ),
tryReset: jest.fn(), tryReset: jest.fn(),
version: jest.fn() version: jest.fn()
} } as unknown as IGitCommandManager & {env: {[key: string]: string}}
settings = { settings = {
authToken: 'some auth token', authToken: 'some auth token',

View File

@ -1,26 +1,51 @@
import * as exec from '@actions/exec' import {
import * as fshelper from '../lib/fs-helper' jest,
import * as commandManager from '../lib/git-command-manager' describe,
it,
expect,
beforeAll,
beforeEach,
afterEach,
afterAll
} from '@jest/globals'
let git: commandManager.IGitCommandManager // Mock @actions/exec
let mockExec = jest.fn() const mockExec = jest.fn()
jest.unstable_mockModule('@actions/exec', () => ({
exec: mockExec
}))
// Mock fs-helper
const mockFileExistsSync = jest.fn()
const mockDirectoryExistsSync = jest.fn()
jest.unstable_mockModule('../src/fs-helper.js', () => ({
fileExistsSync: mockFileExistsSync,
directoryExistsSync: mockDirectoryExistsSync
}))
// Dynamic imports after mocking
const commandManager = await import('../src/git-command-manager.js')
type IGitCommandManager =
import('../src/git-command-manager.js').IGitCommandManager
let git: IGitCommandManager
describe('git-auth-helper tests', () => { describe('git-auth-helper tests', () => {
beforeAll(async () => {}) beforeAll(async () => {})
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn()) mockFileExistsSync.mockReset()
jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn()) mockDirectoryExistsSync.mockReset()
}) })
afterEach(() => { afterEach(() => {
jest.restoreAllMocks() jest.clearAllMocks()
}) })
afterAll(() => {}) afterAll(() => {})
it('branch list matches', async () => { it('branch list matches', async () => {
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
@ -36,7 +61,7 @@ describe('git-auth-helper tests', () => {
return 1 return 1
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
const doSparseCheckout = false const doSparseCheckout = false
@ -53,7 +78,7 @@ describe('git-auth-helper tests', () => {
}) })
it('ambiguous ref name output is captured', async () => { it('ambiguous ref name output is captured', async () => {
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
@ -72,7 +97,7 @@ describe('git-auth-helper tests', () => {
return 1 return 1
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
const doSparseCheckout = false const doSparseCheckout = false
@ -91,9 +116,9 @@ describe('git-auth-helper tests', () => {
describe('Test fetchDepth and fetchTags options', () => { describe('Test fetchDepth and fetchTags options', () => {
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn()) mockFileExistsSync.mockReset()
jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn()) mockDirectoryExistsSync.mockReset()
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
@ -105,11 +130,11 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
afterEach(() => { afterEach(() => {
jest.restoreAllMocks() jest.clearAllMocks()
}) })
it('should call execGit with the correct arguments when fetchDepth is 0', async () => { it('should call execGit with the correct arguments when fetchDepth is 0', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
const doSparseCheckout = false const doSparseCheckout = false
@ -146,7 +171,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when fetchDepth is 0 and refSpec includes tags', async () => { it('should call execGit with the correct arguments when fetchDepth is 0 and refSpec includes tags', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -184,7 +209,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when fetchDepth is 1', async () => { it('should call execGit with the correct arguments when fetchDepth is 1', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -222,7 +247,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when fetchDepth is 1 and refSpec includes tags', async () => { it('should call execGit with the correct arguments when fetchDepth is 1 and refSpec includes tags', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -261,7 +286,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when showProgress is true', async () => { it('should call execGit with the correct arguments when showProgress is true', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -299,7 +324,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when fetchDepth is 42 and showProgress is true', async () => { it('should call execGit with the correct arguments when fetchDepth is 42 and showProgress is true', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -339,7 +364,7 @@ describe('Test fetchDepth and fetchTags options', () => {
}) })
it('should call execGit with the correct arguments when showProgress is true and refSpec includes tags', async () => { it('should call execGit with the correct arguments when showProgress is true and refSpec includes tags', async () => {
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -380,23 +405,23 @@ describe('Test fetchDepth and fetchTags options', () => {
describe('repository initialization object format', () => { describe('repository initialization object format', () => {
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn()) mockFileExistsSync.mockReset()
jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn()) mockDirectoryExistsSync.mockReset()
}) })
afterEach(() => { afterEach(() => {
jest.restoreAllMocks() jest.clearAllMocks()
}) })
it('initializes SHA-256 repositories with the matching object format', async () => { it('initializes SHA-256 repositories with the matching object format', async () => {
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('git version 2.50.1')) options.listeners.stdout(Buffer.from('git version 2.50.1'))
} }
return 0 return 0
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
git = await commandManager.createCommandManager('test', false, false) git = await commandManager.createCommandManager('test', false, false)
@ -410,14 +435,14 @@ describe('repository initialization object format', () => {
}) })
it('initializes SHA-1 repositories with existing default arguments', async () => { it('initializes SHA-1 repositories with existing default arguments', async () => {
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('git version 2.50.1')) options.listeners.stdout(Buffer.from('git version 2.50.1'))
} }
return 0 return 0
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
git = await commandManager.createCommandManager('test', false, false) git = await commandManager.createCommandManager('test', false, false)
@ -433,12 +458,12 @@ describe('repository initialization object format', () => {
describe('git user-agent with orchestration ID', () => { describe('git user-agent with orchestration ID', () => {
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn()) mockFileExistsSync.mockReset()
jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn()) mockDirectoryExistsSync.mockReset()
}) })
afterEach(() => { afterEach(() => {
jest.restoreAllMocks() jest.clearAllMocks()
// Clean up environment variable to prevent test pollution // Clean up environment variable to prevent test pollution
delete process.env['ACTIONS_ORCHESTRATION_ID'] delete process.env['ACTIONS_ORCHESTRATION_ID']
}) })
@ -448,7 +473,7 @@ describe('git user-agent with orchestration ID', () => {
process.env['ACTIONS_ORCHESTRATION_ID'] = orchId process.env['ACTIONS_ORCHESTRATION_ID'] = orchId
let capturedEnv: any = null let capturedEnv: any = null
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.18'))
} }
@ -456,7 +481,7 @@ describe('git user-agent with orchestration ID', () => {
capturedEnv = options.env capturedEnv = options.env
return 0 return 0
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -483,7 +508,7 @@ describe('git user-agent with orchestration ID', () => {
process.env['ACTIONS_ORCHESTRATION_ID'] = orchId process.env['ACTIONS_ORCHESTRATION_ID'] = orchId
let capturedEnv: any = null let capturedEnv: any = null
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.18'))
} }
@ -491,7 +516,7 @@ describe('git user-agent with orchestration ID', () => {
capturedEnv = options.env capturedEnv = options.env
return 0 return 0
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false
@ -517,7 +542,7 @@ describe('git user-agent with orchestration ID', () => {
delete process.env['ACTIONS_ORCHESTRATION_ID'] delete process.env['ACTIONS_ORCHESTRATION_ID']
let capturedEnv: any = null let capturedEnv: any = null
mockExec.mockImplementation((path, args, options) => { mockExec.mockImplementation((path: any, args: any, options: any) => {
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.18'))
} }
@ -525,7 +550,7 @@ describe('git user-agent with orchestration ID', () => {
capturedEnv = options.env capturedEnv = options.env
return 0 return 0
}) })
jest.spyOn(exec, 'exec').mockImplementation(mockExec) // exec.exec is already mockExec
const workingDirectory = 'test' const workingDirectory = 'test'
const lfs = false const lfs = false

View File

@ -1,9 +1,36 @@
import * as core from '@actions/core' import {
jest,
describe,
it,
expect,
beforeAll,
beforeEach,
afterEach
} from '@jest/globals'
import * as fs from 'fs' import * as fs from 'fs'
import * as gitDirectoryHelper from '../lib/git-directory-helper'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as path from 'path' import * as path from 'path'
import {IGitCommandManager} from '../lib/git-command-manager' import {fileURLToPath} from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// Mock @actions/core before loading git-directory-helper
jest.unstable_mockModule('@actions/core', () => ({
error: jest.fn(),
warning: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
setFailed: jest.fn(),
startGroup: jest.fn(),
endGroup: jest.fn()
}))
// Dynamic imports after mocking
const core = await import('@actions/core')
const gitDirectoryHelper = await import('../src/git-directory-helper.js')
type IGitCommandManager =
import('../src/git-command-manager.js').IGitCommandManager
const testWorkspace = path.join(__dirname, '_temp', 'git-directory-helper') const testWorkspace = path.join(__dirname, '_temp', 'git-directory-helper')
let repositoryPath: string let repositoryPath: string
@ -19,16 +46,11 @@ describe('git-directory-helper tests', () => {
}) })
beforeEach(() => { beforeEach(() => {
// Mock error/warning/info/debug jest.clearAllMocks()
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
}) })
afterEach(() => { afterEach(() => {
// Unregister mocks jest.clearAllMocks()
jest.restoreAllMocks()
}) })
const cleansWhenCleanTrue = 'cleans when clean true' const cleansWhenCleanTrue = 'cleans when clean true'
@ -81,7 +103,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(doesNotCheckoutDetachWhenNotAlreadyDetached) await setup(doesNotCheckoutDetachWhenNotAlreadyDetached)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
const mockIsDetached = git.isDetached as jest.Mock<any, any> const mockIsDetached = git.isDetached as jest.Mock<any>
mockIsDetached.mockImplementation(async () => { mockIsDetached.mockImplementation(async () => {
return true return true
}) })
@ -132,7 +154,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(removesContentsWhenCleanFails) await setup(removesContentsWhenCleanFails)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
let mockTryClean = git.tryClean as jest.Mock<any, any> let mockTryClean = git.tryClean as jest.Mock<any>
mockTryClean.mockImplementation(async () => { mockTryClean.mockImplementation(async () => {
return false return false
}) })
@ -210,7 +232,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(removesContentsWhenResetFails) await setup(removesContentsWhenResetFails)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
let mockTryReset = git.tryReset as jest.Mock<any, any> let mockTryReset = git.tryReset as jest.Mock<any>
mockTryReset.mockImplementation(async () => { mockTryReset.mockImplementation(async () => {
return false return false
}) })
@ -260,7 +282,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(removesLocalBranches) await setup(removesLocalBranches)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
const mockBranchList = git.branchList as jest.Mock<any, any> const mockBranchList = git.branchList as jest.Mock<any>
mockBranchList.mockImplementation(async (remote: boolean) => { mockBranchList.mockImplementation(async (remote: boolean) => {
return remote ? [] : ['local-branch-1', 'local-branch-2'] return remote ? [] : ['local-branch-1', 'local-branch-2']
}) })
@ -291,7 +313,7 @@ describe('git-directory-helper tests', () => {
//mock bad submodule //mock bad submodule
const submoduleStatus = git.submoduleStatus as jest.Mock<any, any> const submoduleStatus = git.submoduleStatus as jest.Mock<any>
submoduleStatus.mockImplementation(async (remote: boolean) => { submoduleStatus.mockImplementation(async (remote: boolean) => {
return false return false
}) })
@ -319,7 +341,7 @@ describe('git-directory-helper tests', () => {
await setup(doesNotCleanWhenSubmoduleStatusIsTrue) await setup(doesNotCleanWhenSubmoduleStatusIsTrue)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
const submoduleStatus = git.submoduleStatus as jest.Mock<any, any> const submoduleStatus = git.submoduleStatus as jest.Mock<any>
submoduleStatus.mockImplementation(async (remote: boolean) => { submoduleStatus.mockImplementation(async (remote: boolean) => {
return true return true
}) })
@ -381,7 +403,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(removesAncestorRemoteBranch) await setup(removesAncestorRemoteBranch)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
const mockBranchList = git.branchList as jest.Mock<any, any> const mockBranchList = git.branchList as jest.Mock<any>
mockBranchList.mockImplementation(async (remote: boolean) => { mockBranchList.mockImplementation(async (remote: boolean) => {
return remote ? ['origin/remote-branch-1', 'origin/remote-branch-2'] : [] return remote ? ['origin/remote-branch-1', 'origin/remote-branch-2'] : []
}) })
@ -411,7 +433,7 @@ describe('git-directory-helper tests', () => {
// Arrange // Arrange
await setup(removesDescendantRemoteBranches) await setup(removesDescendantRemoteBranches)
await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '') await fs.promises.writeFile(path.join(repositoryPath, 'my-file'), '')
const mockBranchList = git.branchList as jest.Mock<any, any> const mockBranchList = git.branchList as jest.Mock<any>
mockBranchList.mockImplementation(async (remote: boolean) => { mockBranchList.mockImplementation(async (remote: boolean) => {
return remote return remote
? ['origin/remote-branch-1/conflict', 'origin/remote-branch-2'] ? ['origin/remote-branch-1/conflict', 'origin/remote-branch-2']
@ -507,5 +529,5 @@ async function setup(testName: string): Promise<void> {
return true return true
}), }),
version: jest.fn() version: jest.fn()
} } as unknown as IGitCommandManager
} }

View File

@ -1,5 +1,6 @@
import {GitVersion} from '../src/git-version' import {describe, it, expect} from '@jest/globals'
import {MinimumGitSparseCheckoutVersion} from '../src/git-command-manager' import {GitVersion} from '../src/git-version.js'
import {MinimumGitSparseCheckoutVersion} from '../src/git-command-manager.js'
describe('git-version tests', () => { describe('git-version tests', () => {
it('basics', async () => { it('basics', async () => {

View File

@ -1,11 +1,25 @@
import * as core from '@actions/core' import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals'
import * as github from '@actions/github'
import * as githubApiHelper from '../lib/github-api-helper' // Mock @actions/core
const mockDebug = jest.fn()
jest.unstable_mockModule('@actions/core', () => ({
debug: mockDebug,
info: jest.fn(),
warning: jest.fn(),
error: jest.fn()
}))
// Mock @actions/github
const mockGetOctokit = jest.fn()
jest.unstable_mockModule('@actions/github', () => ({
getOctokit: mockGetOctokit
}))
// Dynamic imports after mocking
const githubApiHelper = await import('../src/github-api-helper.js')
describe('github-api-helper object format', () => { describe('github-api-helper object format', () => {
let getOctokitSpy: jest.SpyInstance let request: jest.Mock<any>
let debugSpy: jest.SpyInstance
let request: jest.Mock
function mockHashAlgorithmApi(hashAlgorithm: string): void { function mockHashAlgorithmApi(hashAlgorithm: string): void {
request = jest.fn(async () => ({ request = jest.fn(async () => ({
@ -13,17 +27,18 @@ describe('github-api-helper object format', () => {
hash_algorithm: hashAlgorithm hash_algorithm: hashAlgorithm
} }
})) }))
getOctokitSpy = jest.spyOn(github, 'getOctokit').mockReturnValue({ mockGetOctokit.mockReturnValue({
request request
} as any) } as any)
} }
beforeEach(() => { beforeEach(() => {
debugSpy = jest.spyOn(core, 'debug').mockImplementation(jest.fn()) mockDebug.mockClear()
mockGetOctokit.mockClear()
}) })
afterEach(() => { afterEach(() => {
jest.restoreAllMocks() jest.clearAllMocks()
}) })
it('detects SHA-256 from the repository hash algorithm endpoint', async () => { it('detects SHA-256 from the repository hash algorithm endpoint', async () => {
@ -33,7 +48,7 @@ describe('github-api-helper object format', () => {
githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo') githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo')
).resolves.toEqual({format: 'sha256', succeeded: true}) ).resolves.toEqual({format: 'sha256', succeeded: true})
expect(getOctokitSpy).toHaveBeenCalledWith( expect(mockGetOctokit).toHaveBeenCalledWith(
'token', 'token',
expect.objectContaining({baseUrl: 'https://api.github.com'}) expect.objectContaining({baseUrl: 'https://api.github.com'})
) )
@ -54,7 +69,6 @@ describe('github-api-helper object format', () => {
it('detects object format from an existing commit without API calls', async () => { it('detects object format from an existing commit without API calls', async () => {
const commitSha = const commitSha =
'9422233ca7ee1b17f1e905d0e141faf0c401556c41cdc6acd71c6bd685da2e92' '9422233ca7ee1b17f1e905d0e141faf0c401556c41cdc6acd71c6bd685da2e92'
getOctokitSpy = jest.spyOn(github, 'getOctokit')
await expect( await expect(
githubApiHelper.tryGetRepositoryObjectFormat( githubApiHelper.tryGetRepositoryObjectFormat(
@ -66,7 +80,7 @@ describe('github-api-helper object format', () => {
) )
).resolves.toEqual({format: 'sha256', succeeded: true}) ).resolves.toEqual({format: 'sha256', succeeded: true})
expect(getOctokitSpy).not.toHaveBeenCalled() expect(mockGetOctokit).not.toHaveBeenCalled()
}) })
it('returns unsuccessful when the hash algorithm endpoint value is not recognized', async () => { it('returns unsuccessful when the hash algorithm endpoint value is not recognized', async () => {
@ -75,7 +89,7 @@ describe('github-api-helper object format', () => {
await expect( await expect(
githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo') githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo')
).resolves.toEqual({format: '', succeeded: false}) ).resolves.toEqual({format: '', succeeded: false})
expect(debugSpy).toHaveBeenCalledWith( expect(mockDebug).toHaveBeenCalledWith(
'Unable to determine repository object format from hash-algorithm endpoint' 'Unable to determine repository object format from hash-algorithm endpoint'
) )
}) })
@ -84,14 +98,14 @@ describe('github-api-helper object format', () => {
request = jest.fn(async () => { request = jest.fn(async () => {
throw new Error('not found') throw new Error('not found')
}) })
jest.spyOn(github, 'getOctokit').mockReturnValue({ mockGetOctokit.mockReturnValue({
request request
} as any) } as any)
await expect( await expect(
githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo') githubApiHelper.tryGetRepositoryObjectFormat('token', 'owner', 'repo')
).resolves.toEqual({format: '', succeeded: false}) ).resolves.toEqual({format: '', succeeded: false})
expect(debugSpy).toHaveBeenCalledWith( expect(mockDebug).toHaveBeenCalledWith(
'Unable to determine repository object format from hash-algorithm endpoint: not found' 'Unable to determine repository object format from hash-algorithm endpoint: not found'
) )
}) })

View File

@ -1,10 +1,13 @@
import * as core from '@actions/core' import {
import * as fsHelper from '../lib/fs-helper' jest,
import * as github from '@actions/github' describe,
import * as inputHelper from '../lib/input-helper' it,
expect,
beforeAll,
beforeEach,
afterAll
} from '@jest/globals'
import * as path from 'path' import * as path from 'path'
import * as workflowContextHelper from '../lib/workflow-context-helper'
import {IGitSourceSettings} from '../lib/git-source-settings'
const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE'] const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']
const gitHubWorkspace = path.resolve('/checkout-tests/workspace') const gitHubWorkspace = path.resolve('/checkout-tests/workspace')
@ -12,42 +15,58 @@ const gitHubWorkspace = path.resolve('/checkout-tests/workspace')
// Inputs for mock @actions/core // Inputs for mock @actions/core
let inputs = {} as any let inputs = {} as any
// Shallow clone original @actions/github context // Mutable mock github context
let originalContext = {...github.context} const mockGithubContext: any = {
ref: 'refs/heads/some-ref',
sha: '1234567890123456789012345678901234567890',
repo: {owner: 'some-owner', repo: 'some-repo'},
eventName: '',
payload: {}
}
// Mock @actions/core before loading input-helper
jest.unstable_mockModule('@actions/core', () => ({
getInput: jest.fn((name: string) => inputs[name]),
getBooleanInput: jest.fn((name: string) => inputs[name]),
getMultilineInput: jest.fn((name: string) =>
inputs[name] ? String(inputs[name]).split('\n').filter(Boolean) : []
),
error: jest.fn(),
warning: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
setFailed: jest.fn(),
setOutput: jest.fn(),
setSecret: jest.fn()
}))
// Mock @actions/github before loading input-helper
jest.unstable_mockModule('@actions/github', () => ({
context: mockGithubContext,
getOctokit: jest.fn()
}))
// Mock fs-helper
const mockDirectoryExistsSync = jest.fn((p: string) => p === gitHubWorkspace)
jest.unstable_mockModule('../src/fs-helper.js', () => ({
directoryExistsSync: mockDirectoryExistsSync,
fileExistsSync: jest.fn()
}))
// Mock workflow-context-helper
const mockGetOrganizationId = jest.fn(async () => 123456)
jest.unstable_mockModule('../src/workflow-context-helper.js', () => ({
getOrganizationId: mockGetOrganizationId
}))
// Dynamic imports after mocking
const core = await import('@actions/core')
const inputHelper = await import('../src/input-helper.js')
type IGitSourceSettings =
import('../src/git-source-settings.js').IGitSourceSettings
describe('input-helper tests', () => { describe('input-helper tests', () => {
beforeAll(() => { beforeAll(() => {
// Mock getInput
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
return inputs[name]
})
// Mock error/warning/info/debug
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
// Mock github context
jest.spyOn(github.context, 'repo', 'get').mockImplementation(() => {
return {
owner: 'some-owner',
repo: 'some-repo'
}
})
github.context.ref = 'refs/heads/some-ref'
github.context.sha = '1234567890123456789012345678901234567890'
// Mock ./fs-helper directoryExistsSync()
jest
.spyOn(fsHelper, 'directoryExistsSync')
.mockImplementation((path: string) => path == gitHubWorkspace)
// Mock ./workflowContextHelper getOrganizationId()
jest
.spyOn(workflowContextHelper, 'getOrganizationId')
.mockImplementation(() => Promise.resolve(123456))
// GitHub workspace // GitHub workspace
process.env['GITHUB_WORKSPACE'] = gitHubWorkspace process.env['GITHUB_WORKSPACE'] = gitHubWorkspace
}) })
@ -55,6 +74,15 @@ describe('input-helper tests', () => {
beforeEach(() => { beforeEach(() => {
// Reset inputs // Reset inputs
inputs = {} inputs = {}
jest.clearAllMocks()
// Re-apply default mocks
;(core.getInput as jest.Mock<any>).mockImplementation(
(name: string) => inputs[name]
)
mockDirectoryExistsSync.mockImplementation(
(p: string) => p === gitHubWorkspace
)
mockGetOrganizationId.mockResolvedValue(123456)
}) })
afterAll(() => { afterAll(() => {
@ -65,11 +93,8 @@ describe('input-helper tests', () => {
} }
// Restore @actions/github context // Restore @actions/github context
github.context.ref = originalContext.ref mockGithubContext.ref = 'refs/heads/some-ref'
github.context.sha = originalContext.sha mockGithubContext.sha = '1234567890123456789012345678901234567890'
// Restore
jest.restoreAllMocks()
}) })
it('sets defaults', async () => { it('sets defaults', async () => {
@ -95,15 +120,15 @@ describe('input-helper tests', () => {
}) })
it('qualifies ref', async () => { it('qualifies ref', async () => {
let originalRef = github.context.ref let originalRef = mockGithubContext.ref
try { try {
github.context.ref = 'some-unqualified-ref' mockGithubContext.ref = 'some-unqualified-ref'
const settings: IGitSourceSettings = await inputHelper.getInputs() const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings).toBeTruthy() expect(settings).toBeTruthy()
expect(settings.commit).toBe('1234567890123456789012345678901234567890') expect(settings.commit).toBe('1234567890123456789012345678901234567890')
expect(settings.ref).toBe('refs/heads/some-unqualified-ref') expect(settings.ref).toBe('refs/heads/some-unqualified-ref')
} finally { } finally {
github.context.ref = originalRef mockGithubContext.ref = originalRef
} }
}) })

View File

@ -1,8 +1,36 @@
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals'
import * as assert from 'assert' import * as assert from 'assert'
import * as core from '@actions/core'
import * as github from '@actions/github' // Mutable mock github context
import * as refHelper from '../lib/ref-helper' const mockGithubContext: any = {
import {IGitCommandManager} from '../lib/git-command-manager' eventName: '',
payload: {},
repo: {owner: 'some-owner', repo: 'some-repo'},
ref: '',
sha: ''
}
// Mock @actions/core
const mockDebug = jest.fn()
jest.unstable_mockModule('@actions/core', () => ({
debug: mockDebug,
info: jest.fn(),
warning: jest.fn(),
error: jest.fn(),
setFailed: jest.fn()
}))
// Mock @actions/github
const mockGetOctokit = jest.fn()
jest.unstable_mockModule('@actions/github', () => ({
context: mockGithubContext,
getOctokit: mockGetOctokit
}))
// Dynamic imports after mocking
const refHelper = await import('../src/ref-helper.js')
type IGitCommandManager =
import('../src/git-command-manager.js').IGitCommandManager
const commit = '1234567890123456789012345678901234567890' const commit = '1234567890123456789012345678901234567890'
const sha256Commit = const sha256Commit =
@ -12,6 +40,7 @@ let git: IGitCommandManager
describe('ref-helper tests', () => { describe('ref-helper tests', () => {
beforeEach(() => { beforeEach(() => {
git = {} as unknown as IGitCommandManager git = {} as unknown as IGitCommandManager
jest.clearAllMocks()
}) })
it('getCheckoutInfo requires git', async () => { it('getCheckoutInfo requires git', async () => {
@ -166,14 +195,12 @@ describe('ref-helper tests', () => {
}) })
it('getRefSpec sha + refs/tags/ with fetchTags', async () => { it('getRefSpec sha + refs/tags/ with fetchTags', async () => {
// When fetchTags is true, only include tags wildcard (specific tag is redundant)
const refSpec = refHelper.getRefSpec('refs/tags/my-tag', commit, true) const refSpec = refHelper.getRefSpec('refs/tags/my-tag', commit, true)
expect(refSpec.length).toBe(1) expect(refSpec.length).toBe(1)
expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*') expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*')
}) })
it('getRefSpec sha + refs/heads/ with fetchTags', async () => { it('getRefSpec sha + refs/heads/ with fetchTags', async () => {
// When fetchTags is true, include both the branch refspec and tags wildcard
const refSpec = refHelper.getRefSpec('refs/heads/my/branch', commit, true) const refSpec = refHelper.getRefSpec('refs/heads/my/branch', commit, true)
expect(refSpec.length).toBe(2) expect(refSpec.length).toBe(2)
expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*') expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*')
@ -194,7 +221,6 @@ describe('ref-helper tests', () => {
}) })
it('getRefSpec unqualified ref only with fetchTags', async () => { it('getRefSpec unqualified ref only with fetchTags', async () => {
// When fetchTags is true, skip specific tag pattern since wildcard covers all
const refSpec = refHelper.getRefSpec('my-ref', '', true) const refSpec = refHelper.getRefSpec('my-ref', '', true)
expect(refSpec.length).toBe(2) expect(refSpec.length).toBe(2)
expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*') expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*')
@ -222,14 +248,12 @@ describe('ref-helper tests', () => {
}) })
it('getRefSpec refs/tags/ only with fetchTags', async () => { it('getRefSpec refs/tags/ only with fetchTags', async () => {
// When fetchTags is true, only include tags wildcard (specific tag is redundant)
const refSpec = refHelper.getRefSpec('refs/tags/my-tag', '', true) const refSpec = refHelper.getRefSpec('refs/tags/my-tag', '', true)
expect(refSpec.length).toBe(1) expect(refSpec.length).toBe(1)
expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*') expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*')
}) })
it('getRefSpec refs/heads/ only with fetchTags', async () => { it('getRefSpec refs/heads/ only with fetchTags', async () => {
// When fetchTags is true, include both the branch refspec and tags wildcard
const refSpec = refHelper.getRefSpec('refs/heads/my/branch', '', true) const refSpec = refHelper.getRefSpec('refs/heads/my/branch', '', true)
expect(refSpec.length).toBe(2) expect(refSpec.length).toBe(2)
expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*') expect(refSpec[0]).toBe('+refs/tags/*:refs/tags/*')
@ -248,9 +272,7 @@ describe('ref-helper tests', () => {
'1111111111222222222233333333334444444444555555555566666666667777' '1111111111222222222233333333334444444444555555555566666666667777'
const sha256Base = const sha256Base =
'aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffff0000' 'aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffff0000'
let debugSpy: jest.SpyInstance let repoGetSpy: jest.Mock<any>
let getOctokitSpy: jest.SpyInstance
let repoGetSpy: jest.Mock
let originalEventName: string let originalEventName: string
let originalPayload: unknown let originalPayload: unknown
let originalRef: string let originalRef: string
@ -261,10 +283,10 @@ describe('ref-helper tests', () => {
expectedBaseSha: string, expectedBaseSha: string,
mergeCommit: string mergeCommit: string
): void { ): void {
;(github.context as any).eventName = 'pull_request' mockGithubContext.eventName = 'pull_request'
github.context.ref = ref mockGithubContext.ref = ref
github.context.sha = mergeCommit mockGithubContext.sha = mergeCommit
;(github.context as any).payload = { mockGithubContext.payload = {
action: 'synchronize', action: 'synchronize',
after: expectedHeadSha, after: expectedHeadSha,
number: 123, number: 123,
@ -280,18 +302,18 @@ describe('ref-helper tests', () => {
} }
beforeEach(() => { beforeEach(() => {
originalEventName = github.context.eventName originalEventName = mockGithubContext.eventName
originalPayload = github.context.payload originalPayload = mockGithubContext.payload
originalRef = github.context.ref originalRef = mockGithubContext.ref
originalSha = github.context.sha originalSha = mockGithubContext.sha
jest.spyOn(github.context, 'repo', 'get').mockReturnValue({ mockGithubContext.repo = {
owner: repositoryOwner, owner: repositoryOwner,
repo: repositoryName repo: repositoryName
}) }
debugSpy = jest.spyOn(core, 'debug').mockImplementation(jest.fn())
repoGetSpy = jest.fn(async () => ({})) repoGetSpy = jest.fn(async () => ({}))
getOctokitSpy = jest.spyOn(github, 'getOctokit').mockReturnValue({ mockGetOctokit.mockReturnValue({
rest: { rest: {
repos: { repos: {
get: repoGetSpy get: repoGetSpy
@ -301,11 +323,11 @@ describe('ref-helper tests', () => {
}) })
afterEach(() => { afterEach(() => {
;(github.context as any).eventName = originalEventName mockGithubContext.eventName = originalEventName
;(github.context as any).payload = originalPayload mockGithubContext.payload = originalPayload
github.context.ref = originalRef mockGithubContext.ref = originalRef
github.context.sha = originalSha mockGithubContext.sha = originalSha
jest.restoreAllMocks() jest.clearAllMocks()
}) })
it('returns early for SHA-1 merge commit', async () => { it('returns early for SHA-1 merge commit', async () => {
@ -320,7 +342,7 @@ describe('ref-helper tests', () => {
commit commit
) )
expect(getOctokitSpy).not.toHaveBeenCalled() expect(mockGetOctokit).not.toHaveBeenCalled()
expect(repoGetSpy).not.toHaveBeenCalled() expect(repoGetSpy).not.toHaveBeenCalled()
}) })
@ -338,7 +360,7 @@ describe('ref-helper tests', () => {
sha256Commit sha256Commit
) )
expect(getOctokitSpy).toHaveBeenCalledWith( expect(mockGetOctokit).toHaveBeenCalledWith(
'token', 'token',
expect.objectContaining({ expect.objectContaining({
userAgent: expect.stringContaining( userAgent: expect.stringContaining(
@ -350,10 +372,10 @@ describe('ref-helper tests', () => {
owner: repositoryOwner, owner: repositoryOwner,
repo: repositoryName repo: repositoryName
}) })
expect(debugSpy).toHaveBeenCalledWith( expect(mockDebug).toHaveBeenCalledWith(
`Expected head sha ${sha256Head}; actual head sha ${actualHeadSha}` `Expected head sha ${sha256Head}; actual head sha ${actualHeadSha}`
) )
expect(debugSpy).not.toHaveBeenCalledWith('Unexpected message format') expect(mockDebug).not.toHaveBeenCalledWith('Unexpected message format')
}) })
it('does not match 50-char hex as a valid merge', async () => { it('does not match 50-char hex as a valid merge', async () => {
@ -370,9 +392,9 @@ describe('ref-helper tests', () => {
commit commit
) )
expect(getOctokitSpy).not.toHaveBeenCalled() expect(mockGetOctokit).not.toHaveBeenCalled()
expect(repoGetSpy).not.toHaveBeenCalled() expect(repoGetSpy).not.toHaveBeenCalled()
expect(debugSpy).toHaveBeenCalledWith('Unexpected message format') expect(mockDebug).toHaveBeenCalledWith('Unexpected message format')
}) })
}) })
}) })

View File

@ -1,16 +1,32 @@
import * as core from '@actions/core' import {
import {RetryHelper} from '../lib/retry-helper' jest,
describe,
it,
expect,
beforeAll,
beforeEach,
afterAll
} from '@jest/globals'
let info: string[] = []
// Mock @actions/core before loading retry-helper
jest.unstable_mockModule('@actions/core', () => ({
info: jest.fn((message: string) => {
info.push(message)
}),
debug: jest.fn(),
warning: jest.fn(),
error: jest.fn()
}))
// Dynamic imports after mocking
const {RetryHelper} = await import('../src/retry-helper.js')
let info: string[]
let retryHelper: any let retryHelper: any
describe('retry-helper tests', () => { describe('retry-helper tests', () => {
beforeAll(() => { beforeAll(() => {
// Mock @actions/core info()
jest.spyOn(core, 'info').mockImplementation((message: string) => {
info.push(message)
})
retryHelper = new RetryHelper(3, 0, 0) retryHelper = new RetryHelper(3, 0, 0)
}) })
@ -20,7 +36,6 @@ describe('retry-helper tests', () => {
}) })
afterAll(() => { afterAll(() => {
// Restore
jest.restoreAllMocks() jest.restoreAllMocks()
}) })

View File

@ -1,10 +1,12 @@
import * as github from '@actions/github' import {
import {assertSafePrCheckout} from '../lib/unsafe-pr-checkout-helper' jest,
describe,
// Shallow clone original @actions/github context it,
const originalContext = {...github.context} expect,
const originalEventName = github.context.eventName beforeAll,
const originalPayload = github.context.payload afterEach,
afterAll
} from '@jest/globals'
const BASE_REPO_ID = 100 const BASE_REPO_ID = 100
const FORK_REPO_ID = 200 const FORK_REPO_ID = 200
@ -15,9 +17,30 @@ const WORKFLOW_RUN_HEAD_COMMIT_SHA = '4444444444444444444444444444444444444444'
const BASE_QUALIFIED_REPO = 'some-owner/some-repo' const BASE_QUALIFIED_REPO = 'some-owner/some-repo'
const FORK_QUALIFIED_REPO = 'another-repo/fork' const FORK_QUALIFIED_REPO = 'another-repo/fork'
// Mutable mock context
const mockContext: any = {
eventName: '',
payload: {},
repo: {owner: 'some-owner', repo: 'some-repo'},
ref: '',
sha: ''
}
jest.unstable_mockModule('@actions/github', () => ({
context: mockContext
}))
// Dynamic imports after mocking
const {assertSafePrCheckout} = await import(
'../src/unsafe-pr-checkout-helper.js'
)
const originalEventName = mockContext.eventName
const originalPayload = mockContext.payload
function setContext(eventName: string, payload: object): void { function setContext(eventName: string, payload: object): void {
;(github.context as {eventName: string}).eventName = eventName mockContext.eventName = eventName
;(github.context as {payload: object}).payload = payload mockContext.payload = payload
} }
function forkPullRequestTargetPayload(): object { function forkPullRequestTargetPayload(): object {
@ -59,22 +82,17 @@ function forkWorkflowRunPayload(): object {
describe('unsafe-pr-checkout-helper', () => { describe('unsafe-pr-checkout-helper', () => {
beforeAll(() => { beforeAll(() => {
jest.spyOn(github.context, 'repo', 'get').mockReturnValue({ mockContext.repo = {owner: 'some-owner', repo: 'some-repo'}
owner: 'some-owner',
repo: 'some-repo'
})
}) })
afterEach(() => { afterEach(() => {
;(github.context as {eventName: string}).eventName = originalEventName mockContext.eventName = originalEventName
;(github.context as {payload: object}).payload = originalPayload mockContext.payload = originalPayload
}) })
afterAll(() => { afterAll(() => {
;(github.context as {eventName: string}).eventName = mockContext.eventName = originalEventName
originalContext.eventName mockContext.payload = originalPayload
;(github.context as {payload: object}).payload = originalContext.payload
jest.restoreAllMocks()
}) })
it('allows pull_request events untouched', () => { it('allows pull_request events untouched', () => {

View File

@ -1,4 +1,5 @@
import * as urlHelper from '../src/url-helper' import {jest, describe, it, expect, beforeEach, afterAll} from '@jest/globals'
import * as urlHelper from '../src/url-helper.js'
describe('getServerUrl tests', () => { describe('getServerUrl tests', () => {
it('basics', async () => { it('basics', async () => {

51847
dist/index.js vendored

File diff suppressed because one or more lines are too long

3
dist/package.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@ -1,12 +0,0 @@
module.exports = {
clearMocks: true,
fakeTimers: {},
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

24
jest.config.ts Normal file
View File

@ -0,0 +1,24 @@
export default {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
roots: ['<rootDir>'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': [
'ts-jest',
{
useESM: true,
diagnostics: {
ignoreCodes: [151002]
}
}
]
},
extensionsToTreatAsEsm: ['.ts'],
transformIgnorePatterns: ['node_modules/(?!(@actions)/)'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
verbose: true
}

484
package-lock.json generated
View File

@ -9,27 +9,30 @@
"version": "5.0.0", "version": "5.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^3.0.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^3.0.0",
"@actions/github": "^6.0.0", "@actions/github": "^9.1.1",
"@actions/io": "^1.1.3", "@actions/io": "^3.0.2",
"@actions/tool-cache": "^2.0.2" "@actions/tool-cache": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^24.1.0", "@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^7.9.0", "@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0", "@typescript-eslint/parser": "^7.9.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.4",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^28.8.2", "eslint-plugin-jest": "^28.8.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0",
"js-yaml": "^4.2.0", "js-yaml": "^4.2.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4" "typescript": "^5.5.4"
},
"engines": {
"node": ">=24"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
@ -42,59 +45,88 @@
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.11.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.1.tgz",
"integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", "integrity": "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/exec": "^1.1.1", "@actions/exec": "^3.0.0",
"@actions/http-client": "^2.0.1" "@actions/http-client": "^4.0.0"
} }
}, },
"node_modules/@actions/exec": { "node_modules/@actions/exec": {
"version": "1.1.1", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz",
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", "integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==",
"license": "MIT",
"dependencies": { "dependencies": {
"@actions/io": "^1.0.1" "@actions/io": "^3.0.2"
} }
}, },
"node_modules/@actions/github": { "node_modules/@actions/github": {
"version": "6.0.0", "version": "9.1.1",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/github/-/github-9.1.1.tgz",
"integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", "integrity": "sha512-tL5JbYOBZHc0ngEnCsaDcryUizIUIlQyIMwy1Wkx93H5HzbBJ7TbiPx2PnFjBwZW0Vh05JmfFZhecE6gglYegA==",
"license": "MIT",
"dependencies": { "dependencies": {
"@actions/http-client": "^2.2.0", "@actions/http-client": "^3.0.2",
"@octokit/core": "^5.0.1", "@octokit/core": "^7.0.6",
"@octokit/plugin-paginate-rest": "^9.0.0", "@octokit/plugin-paginate-rest": "^14.0.0",
"@octokit/plugin-rest-endpoint-methods": "^10.0.0" "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
"@octokit/request": "^10.0.7",
"@octokit/request-error": "^7.1.0",
"undici": "^6.23.0"
}
},
"node_modules/@actions/github/node_modules/@actions/http-client": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz",
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
} }
}, },
"node_modules/@actions/http-client": { "node_modules/@actions/http-client": {
"version": "2.2.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.1.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.1.tgz",
"integrity": "sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw==", "integrity": "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg==",
"license": "MIT",
"dependencies": { "dependencies": {
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"undici": "^5.25.4" "undici": "^6.23.0"
} }
}, },
"node_modules/@actions/io": { "node_modules/@actions/io": {
"version": "1.1.3", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz",
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==" "integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==",
"license": "MIT"
}, },
"node_modules/@actions/tool-cache": { "node_modules/@actions/tool-cache": {
"version": "2.0.2", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-4.0.0.tgz",
"integrity": "sha512-fBhNNOWxuoLxztQebpOaWu6WeVmuwa77Z+DxIZ1B+OYvGkGQon6kTVg6Z32Cb13WCuw0szqonK+hh03mJV7Z6w==", "integrity": "sha512-L8P9HbXvpvqjZDveb/fdsa55IVC0trfPgQ4ZwGo6r5af6YDVdM9vMGPZ7rgY2fAT9gGj4PSYd6bYlg3p3jD78A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^3.0.0",
"@actions/exec": "^1.0.0", "@actions/exec": "^3.0.0",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^4.0.0",
"@actions/io": "^1.1.1", "@actions/io": "^3.0.0",
"semver": "^6.1.0" "semver": "^7.7.3"
}
},
"node_modules/@actions/tool-cache/node_modules/semver": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -604,6 +636,30 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true "dev": true
}, },
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "0.3.9"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@eslint-community/eslint-utils": { "node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@ -683,14 +739,6 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
} }
}, },
"node_modules/@fastify/busboy": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"engines": {
"node": ">=14"
}
},
"node_modules/@github/browserslist-config": { "node_modules/@github/browserslist-config": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@github/browserslist-config/-/browserslist-config-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@github/browserslist-config/-/browserslist-config-1.0.0.tgz",
@ -1223,151 +1271,131 @@
} }
}, },
"node_modules/@octokit/auth-token": { "node_modules/@octokit/auth-token": {
"version": "4.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", "integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
"license": "MIT",
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/core": { "node_modules/@octokit/core": {
"version": "5.2.0", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
"integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
"license": "MIT",
"dependencies": { "dependencies": {
"@octokit/auth-token": "^4.0.0", "@octokit/auth-token": "^6.0.0",
"@octokit/graphql": "^7.1.0", "@octokit/graphql": "^9.0.3",
"@octokit/request": "^8.3.1", "@octokit/request": "^10.0.6",
"@octokit/request-error": "^5.1.0", "@octokit/request-error": "^7.0.2",
"@octokit/types": "^13.0.0", "@octokit/types": "^16.0.0",
"before-after-hook": "^2.2.0", "before-after-hook": "^4.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^7.0.0"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/endpoint": { "node_modules/@octokit/endpoint": {
"version": "9.0.6", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.3.tgz",
"integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", "integrity": "sha512-FWFlNxghg4HrXkD3ifYbS/IdL/mDHjh9QcsNyhQjN8dplUoZbejsdpmuqdA76nxj2xoWPs7p8uX2SNr9rYu0Ag==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@octokit/types": "^13.1.0", "@octokit/types": "^16.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^7.0.2"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/graphql": { "node_modules/@octokit/graphql": {
"version": "7.1.0", "version": "9.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz",
"integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", "integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==",
"license": "MIT",
"dependencies": { "dependencies": {
"@octokit/request": "^8.3.0", "@octokit/request": "^10.0.6",
"@octokit/types": "^13.0.0", "@octokit/types": "^16.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^7.0.0"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/openapi-types": { "node_modules/@octokit/openapi-types": {
"version": "22.1.0", "version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.1.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-pGUdSP+eEPfZiQHNkZI0U01HLipxncisdJQB4G//OAmfeO8sqTQ9KRa0KF03TUPCziNsoXUrTg4B2Q1EX++T0Q==" "integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
}, },
"node_modules/@octokit/plugin-paginate-rest": { "node_modules/@octokit/plugin-paginate-rest": {
"version": "9.2.2", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz",
"integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==", "integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@octokit/types": "^12.6.0" "@octokit/types": "^16.0.0"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
}, },
"peerDependencies": { "peerDependencies": {
"@octokit/core": "5" "@octokit/core": ">=6"
}
},
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="
},
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
} }
}, },
"node_modules/@octokit/plugin-rest-endpoint-methods": { "node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "10.4.1", "version": "17.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz",
"integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", "integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==",
"license": "MIT",
"dependencies": { "dependencies": {
"@octokit/types": "^12.6.0" "@octokit/types": "^16.0.0"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
}, },
"peerDependencies": { "peerDependencies": {
"@octokit/core": "5" "@octokit/core": ">=6"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="
},
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
} }
}, },
"node_modules/@octokit/request": { "node_modules/@octokit/request": {
"version": "8.4.1", "version": "10.0.10",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.10.tgz",
"integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", "integrity": "sha512-KxNC2pTqqhszMNrf12ZRd4PonRgyJdsM4F/jySiddQK+DsRcfBtUvqn8t7UsyZhnRJHvX46OohDt5N3VqIWC2w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@octokit/endpoint": "^9.0.6", "@octokit/endpoint": "^11.0.3",
"@octokit/request-error": "^5.1.1", "@octokit/request-error": "^7.0.2",
"@octokit/types": "^13.1.0", "@octokit/types": "^16.0.0",
"universal-user-agent": "^6.0.0" "content-type": "^2.0.0",
"json-with-bigint": "^3.5.3",
"universal-user-agent": "^7.0.2"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/request-error": { "node_modules/@octokit/request-error": {
"version": "5.1.1", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz",
"integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", "integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@octokit/types": "^13.1.0", "@octokit/types": "^16.0.0"
"deprecation": "^2.0.0",
"once": "^1.4.0"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/@octokit/types": { "node_modules/@octokit/types": {
"version": "13.4.1", "version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-Y73oOAzRBAUzR/iRAbGULzpNkX8vaxKCqEtg6K74Ff3w9f5apFnWtE/2nade7dMWWW3bS5Kkd6DJS4HF04xreg==", "integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": { "dependencies": {
"@octokit/openapi-types": "^22.1.0" "@octokit/openapi-types": "^27.0.0"
} }
}, },
"node_modules/@pkgr/core": { "node_modules/@pkgr/core": {
@ -1406,6 +1434,34 @@
"@sinonjs/commons": "^3.0.0" "@sinonjs/commons": "^3.0.0"
} }
}, },
"node_modules/@tsconfig/node10": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",
"integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@tsconfig/node12": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
"dev": true,
"license": "MIT"
},
"node_modules/@tsconfig/node14": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
"dev": true,
"license": "MIT"
},
"node_modules/@tsconfig/node16": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/babel__core": { "node_modules/@types/babel__core": {
"version": "7.20.5", "version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@ -1730,10 +1786,11 @@
"dev": true "dev": true
}, },
"node_modules/@vercel/ncc": { "node_modules/@vercel/ncc": {
"version": "0.38.1", "version": "0.38.4",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz",
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", "integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"ncc": "dist/ncc/cli.js" "ncc": "dist/ncc/cli.js"
} }
@ -1759,6 +1816,19 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/acorn-walk": {
"version": "8.3.5",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz",
"integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==",
"dev": true,
"license": "MIT",
"dependencies": {
"acorn": "^8.11.0"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ajv": { "node_modules/ajv": {
"version": "6.12.6", "version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@ -1839,6 +1909,13 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"dev": true,
"license": "MIT"
},
"node_modules/argparse": { "node_modules/argparse": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -2136,9 +2213,10 @@
"dev": true "dev": true
}, },
"node_modules/before-after-hook": { "node_modules/before-after-hook": {
"version": "2.2.3", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" "integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "2.0.2", "version": "2.0.2",
@ -2378,6 +2456,19 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true "dev": true
}, },
"node_modules/content-type": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
"integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/convert-source-map": { "node_modules/convert-source-map": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
@ -2405,6 +2496,13 @@
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
} }
}, },
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
"dev": true,
"license": "MIT"
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.6", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@ -2557,11 +2655,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"node_modules/dequal": { "node_modules/dequal": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
@ -2580,6 +2673,16 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/diff": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
"integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/diff-sequences": { "node_modules/diff-sequences": {
"version": "29.6.3", "version": "29.6.3",
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz",
@ -5221,6 +5324,12 @@
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
"dev": true "dev": true
}, },
"node_modules/json-with-bigint": {
"version": "3.5.8",
"resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.5.8.tgz",
"integrity": "sha512-eq/4KP6K34kwa7TcFdtvnftvHCD9KvHOGGICWwMFc4dOOKF5t4iYqnfLK8otCRCRv06FXOzGGyqE8h8ElMvvdw==",
"license": "MIT"
},
"node_modules/json5": { "node_modules/json5": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
@ -5645,6 +5754,7 @@
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"dependencies": { "dependencies": {
"wrappy": "1" "wrappy": "1"
} }
@ -6210,6 +6320,7 @@
"version": "6.3.1", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true,
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
@ -6659,6 +6770,50 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/ts-node": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
"@tsconfig/node12": "^1.0.7",
"@tsconfig/node14": "^1.0.0",
"@tsconfig/node16": "^1.0.2",
"acorn": "^8.4.1",
"acorn-walk": "^8.1.1",
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"v8-compile-cache-lib": "^3.0.1",
"yn": "3.1.1"
},
"bin": {
"ts-node": "dist/bin.js",
"ts-node-cwd": "dist/bin-cwd.js",
"ts-node-esm": "dist/bin-esm.js",
"ts-node-script": "dist/bin-script.js",
"ts-node-transpile-only": "dist/bin-transpile.js",
"ts-script": "dist/bin-script-deprecated.js"
},
"peerDependencies": {
"@swc/core": ">=1.2.50",
"@swc/wasm": ">=1.2.50",
"@types/node": "*",
"typescript": ">=2.7"
},
"peerDependenciesMeta": {
"@swc/core": {
"optional": true
},
"@swc/wasm": {
"optional": true
}
}
},
"node_modules/tsconfig-paths": { "node_modules/tsconfig-paths": {
"version": "3.15.0", "version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
@ -6702,6 +6857,7 @@
"version": "0.0.6", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"license": "MIT",
"engines": { "engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3" "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
} }
@ -6841,15 +6997,12 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "5.29.0", "version": "6.27.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
"license": "MIT", "license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"engines": { "engines": {
"node": ">=14.0" "node": ">=18.17"
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
@ -6859,9 +7012,10 @@
"dev": true "dev": true
}, },
"node_modules/universal-user-agent": { "node_modules/universal-user-agent": {
"version": "6.0.1", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.0.13", "version": "1.0.13",
@ -6902,6 +7056,13 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"dev": true,
"license": "MIT"
},
"node_modules/v8-to-istanbul": { "node_modules/v8-to-istanbul": {
"version": "9.2.0", "version": "9.2.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz",
@ -7039,7 +7200,8 @@
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
}, },
"node_modules/write-file-atomic": { "node_modules/write-file-atomic": {
"version": "4.0.2", "version": "4.0.2",
@ -7096,6 +7258,16 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/yocto-queue": { "node_modules/yocto-queue": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",

View File

@ -2,13 +2,14 @@
"name": "checkout", "name": "checkout",
"version": "5.0.0", "version": "5.0.0",
"description": "checkout action", "description": "checkout action",
"type": "module",
"main": "lib/main.js", "main": "lib/main.js",
"scripts": { "scripts": {
"build": "tsc && ncc build && node lib/misc/generate-docs.js", "build": "tsc && ncc build src/main.ts -o dist && node lib/misc/generate-docs.js",
"format": "prettier --write '**/*.ts'", "format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'", "format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"test": "jest", "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"licensed-check": "src/misc/licensed-check.sh", "licensed-check": "src/misc/licensed-check.sh",
"licensed-generate": "src/misc/licensed-generate.sh" "licensed-generate": "src/misc/licensed-generate.sh"
}, },
@ -27,27 +28,30 @@
"url": "https://github.com/actions/checkout/issues" "url": "https://github.com/actions/checkout/issues"
}, },
"homepage": "https://github.com/actions/checkout#readme", "homepage": "https://github.com/actions/checkout#readme",
"engines": {
"node": ">=24"
},
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^3.0.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^3.0.0",
"@actions/github": "^6.0.0", "@actions/github": "^9.1.1",
"@actions/io": "^1.1.3", "@actions/io": "^3.0.2",
"@actions/tool-cache": "^2.0.2" "@actions/tool-cache": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^24.1.0", "@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^7.9.0", "@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0", "@typescript-eslint/parser": "^7.9.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.4",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^28.8.2", "eslint-plugin-jest": "^28.8.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0",
"js-yaml": "^4.2.0", "js-yaml": "^4.2.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
} }

View File

@ -5,12 +5,12 @@ import * as fs from 'fs'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import * as regexpHelper from './regexp-helper' import * as regexpHelper from './regexp-helper.js'
import * as stateHelper from './state-helper' import * as stateHelper from './state-helper.js'
import * as urlHelper from './url-helper' import * as urlHelper from './url-helper.js'
import {randomUUID} from 'crypto' import {randomUUID} from 'crypto'
import {IGitCommandManager} from './git-command-manager' import {IGitCommandManager} from './git-command-manager.js'
import {IGitSourceSettings} from './git-source-settings' import {IGitSourceSettings} from './git-source-settings.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
const SSH_COMMAND_KEY = 'core.sshCommand' const SSH_COMMAND_KEY = 'core.sshCommand'

View File

@ -1,13 +1,13 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import * as fs from 'fs' import * as fs from 'fs'
import * as fshelper from './fs-helper' import * as fshelper from './fs-helper.js'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as path from 'path' import * as path from 'path'
import * as refHelper from './ref-helper' import * as refHelper from './ref-helper.js'
import * as regexpHelper from './regexp-helper' import * as regexpHelper from './regexp-helper.js'
import * as retryHelper from './retry-helper' import * as retryHelper from './retry-helper.js'
import {GitVersion} from './git-version' import {GitVersion} from './git-version.js'
// Auth header not supported before 2.9 // Auth header not supported before 2.9
// Wire protocol v2 not supported before 2.18 // Wire protocol v2 not supported before 2.18

View File

@ -1,10 +1,10 @@
import * as assert from 'assert' import * as assert from 'assert'
import * as core from '@actions/core' import * as core from '@actions/core'
import * as fs from 'fs' import * as fs from 'fs'
import * as fsHelper from './fs-helper' import * as fsHelper from './fs-helper.js'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as path from 'path' import * as path from 'path'
import {IGitCommandManager} from './git-command-manager' import {IGitCommandManager} from './git-command-manager.js'
export async function prepareExistingDirectory( export async function prepareExistingDirectory(
git: IGitCommandManager | undefined, git: IGitCommandManager | undefined,

View File

@ -1,19 +1,19 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as fsHelper from './fs-helper' import * as fsHelper from './fs-helper.js'
import * as gitAuthHelper from './git-auth-helper' import * as gitAuthHelper from './git-auth-helper.js'
import * as gitCommandManager from './git-command-manager' import * as gitCommandManager from './git-command-manager.js'
import * as gitDirectoryHelper from './git-directory-helper' import * as gitDirectoryHelper from './git-directory-helper.js'
import * as githubApiHelper from './github-api-helper' import * as githubApiHelper from './github-api-helper.js'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as path from 'path' import * as path from 'path'
import * as refHelper from './ref-helper' import * as refHelper from './ref-helper.js'
import * as stateHelper from './state-helper' import * as stateHelper from './state-helper.js'
import * as urlHelper from './url-helper' import * as urlHelper from './url-helper.js'
import { import {
MinimumGitSparseCheckoutVersion, MinimumGitSparseCheckoutVersion,
IGitCommandManager IGitCommandManager
} from './git-command-manager' } from './git-command-manager.js'
import {IGitSourceSettings} from './git-source-settings' import {IGitSourceSettings} from './git-source-settings.js'
export async function getSource(settings: IGitSourceSettings): Promise<void> { export async function getSource(settings: IGitSourceSettings): Promise<void> {
// Repository URL // Repository URL

View File

@ -4,10 +4,10 @@ import * as fs from 'fs'
import * as github from '@actions/github' import * as github from '@actions/github'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as path from 'path' import * as path from 'path'
import * as retryHelper from './retry-helper' import * as retryHelper from './retry-helper.js'
import * as toolCache from '@actions/tool-cache' import * as toolCache from '@actions/tool-cache'
import {randomUUID} from 'crypto' import {randomUUID} from 'crypto'
import {getServerApiUrl} from './url-helper' import {getServerApiUrl} from './url-helper.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'

View File

@ -1,10 +1,10 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as fsHelper from './fs-helper' import * as fsHelper from './fs-helper.js'
import * as github from '@actions/github' import * as github from '@actions/github'
import * as path from 'path' import * as path from 'path'
import * as unsafePrCheckoutHelper from './unsafe-pr-checkout-helper' import * as unsafePrCheckoutHelper from './unsafe-pr-checkout-helper.js'
import * as workflowContextHelper from './workflow-context-helper' import * as workflowContextHelper from './workflow-context-helper.js'
import {IGitSourceSettings} from './git-source-settings' import {IGitSourceSettings} from './git-source-settings.js'
export async function getInputs(): Promise<IGitSourceSettings> { export async function getInputs(): Promise<IGitSourceSettings> {
const result = {} as unknown as IGitSourceSettings const result = {} as unknown as IGitSourceSettings

View File

@ -1,9 +1,11 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as coreCommand from '@actions/core/lib/command' import * as gitSourceProvider from './git-source-provider.js'
import * as gitSourceProvider from './git-source-provider' import * as inputHelper from './input-helper.js'
import * as inputHelper from './input-helper'
import * as path from 'path' import * as path from 'path'
import * as stateHelper from './state-helper' import * as stateHelper from './state-helper.js'
import {fileURLToPath} from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
async function run(): Promise<void> { async function run(): Promise<void> {
try { try {
@ -11,10 +13,8 @@ async function run(): Promise<void> {
try { try {
// Register problem matcher // Register problem matcher
coreCommand.issueCommand( core.info(
'add-matcher', `::add-matcher::${path.join(__dirname, 'problem-matcher.json')}`
{},
path.join(__dirname, 'problem-matcher.json')
) )
// Get sources // Get sources
@ -22,7 +22,7 @@ async function run(): Promise<void> {
core.setOutput('ref', sourceSettings.ref) core.setOutput('ref', sourceSettings.ref)
} finally { } finally {
// Unregister problem matcher // Unregister problem matcher
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '') core.info('::remove-matcher owner=checkout-git::')
} }
} catch (error) { } catch (error) {
core.setFailed(`${(error as any)?.message ?? error}`) core.setFailed(`${(error as any)?.message ?? error}`)

View File

@ -2,6 +2,9 @@ import * as fs from 'fs'
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import * as yaml from 'js-yaml' import * as yaml from 'js-yaml'
import {fileURLToPath} from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// //
// SUMMARY // SUMMARY

View File

@ -1,7 +1,7 @@
import {IGitCommandManager} from './git-command-manager' import {IGitCommandManager} from './git-command-manager.js'
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {getServerApiUrl, isGhes} from './url-helper' import {getServerApiUrl, isGhes} from './url-helper.js'
export const tagsRefSpec = '+refs/tags/*:refs/tags/*' export const tagsRefSpec = '+refs/tags/*:refs/tags/*'

View File

@ -1,5 +1,5 @@
import * as github from '@actions/github' import * as github from '@actions/github'
import {fromPayload} from './ref-helper' import {fromPayload} from './ref-helper.js'
const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/ const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/

View File

@ -1,6 +1,6 @@
import * as assert from 'assert' import * as assert from 'assert'
import {URL} from 'url' import {URL} from 'url'
import {IGitSourceSettings} from './git-source-settings' import {IGitSourceSettings} from './git-source-settings.js'
export function getFetchUrl(settings: IGitSourceSettings): string { export function getFetchUrl(settings: IGitSourceSettings): string {
assert.ok( assert.ok(

View File

@ -1,17 +1,13 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "ES2022",
"module": "commonjs", "module": "NodeNext",
"lib": [ "moduleResolution": "NodeNext",
"es6"
],
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
"declaration": true,
"strict": true, "strict": true,
"noImplicitAny": false, "noImplicitAny": false,
"esModuleInterop": true, "esModuleInterop": true
"skipLibCheck": true
}, },
"exclude": ["__test__", "lib", "node_modules"] "exclude": ["__test__", "lib", "node_modules", "jest.config.ts"]
} }