Fix checkout init for SHA-256 repositories (#2439)
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 17s
Check dist / check-dist (push) Failing after 19s
Build and Test / build (push) Failing after 2s
Licensed / Check licenses (push) Successful in 14s
Build and Test / test-proxy (push) Failing after 3s
Build and Test / test (ubuntu-latest) (push) Failing after 50s
Build and Test / test-bypass-proxy (push) Failing after 36s
Build and Test / test-git-container (push) Failing after 16s
Build and Test / test-output (push) Successful in 5s
Build and Test / test (macos-latest) (push) Has been cancelled
Build and Test / test (windows-latest) (push) Has been cancelled

* Fix checkout init for SHA-256 repositories

* Remove unused object format result field
This commit is contained in:
Yashwanth Anantharaju
2026-06-01 11:35:58 -04:00
committed by GitHub
parent 900f2210b1
commit 1cce3390c2
6 changed files with 282 additions and 7 deletions

View File

@@ -109,8 +109,25 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
if (
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
) {
core.startGroup('Determining repository object format')
const objectFormatResult =
await githubApiHelper.tryGetRepositoryObjectFormat(
settings.authToken,
settings.repositoryOwner,
settings.repositoryName,
settings.githubServerUrl,
settings.commit
)
const objectFormat = objectFormatResult.succeeded
? objectFormatResult.format
: ''
if (objectFormat === 'sha256') {
core.info('Detected SHA-256 repository object format')
}
core.endGroup()
core.startGroup('Initializing the repository')
await git.init()
await git.init(objectFormat)
await git.remoteAdd('origin', repositoryUrl)
core.endGroup()
}