Fix checkout init for SHA-256 repositories#2439
Merged
Merged
Conversation
f279b42 to
67bd696
Compare
hhaador
approved these changes
May 22, 2026
BastirEiii
approved these changes
May 23, 2026
12bc7fa to
d2a514d
Compare
d2a514d to
4823ef7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes checkout for SHA-256 repositories by detecting the target repository's object format before git init and initializing the local repo with --object-format=sha256 when appropriate. Detection uses either the existing commit SHA length (40/64 hex chars) or a pre-init call to GET /repos/{owner}/{repo}/hash-algorithm via the existing action token; SHA-1 and undetermined cases preserve the prior default git init behavior.
Changes:
- Add
tryGetRepositoryObjectFormatingithub-api-helper.ts(commit-SHA-based or hash-algorithm endpoint). - Extend
git.init()to accept an optionalobjectFormatand append--object-format=sha256when applicable. - Wire detection into
git-source-provider.tsbefore init, and add unit tests + rebuiltdist/index.js.
Show a summary per file
| File | Description |
|---|---|
| src/github-api-helper.ts | Adds RepositoryObjectFormatResult interface, tryGetRepositoryObjectFormat, and getObjectFormat SHA-length helper. |
| src/git-source-provider.ts | Detects object format prior to repo initialization and passes it to git.init. |
| src/git-command-manager.ts | Updates init() signature/impl to optionally pass --object-format=sha256. |
| dist/index.js | Regenerated bundle reflecting the above source changes. |
| test/github-api-helper.test.ts | New tests covering sha1/sha256/unknown/error responses and SHA-based detection without API calls. |
| test/git-command-manager.test.ts | New tests verifying git init arguments for sha256 vs sha1 inputs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/6 changed files
- Comments generated: 1
AllanGuigou
approved these changes
Jun 1, 2026
1 task
eleboucher
pushed a commit
to eleboucher/talos-mcp
that referenced
this pull request
Jun 2, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.3`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](actions/checkout@v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwidHlwZS9wYXRjaCJdfQ==--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/talos-mcp/pulls/8
eleboucher
pushed a commit
to eleboucher/apoci
that referenced
this pull request
Jun 2, 2026
…#59) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.3`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](actions/checkout@v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwidHlwZS9wYXRjaCJdfQ==--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/apoci/pulls/59
eleboucher
pushed a commit
to eleboucher/runner-k8s-plugin
that referenced
this pull request
Jun 2, 2026
…#60) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.3`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](actions/checkout@v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwidHlwZS9wYXRjaCJdfQ==--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/runner-k8s-plugin/pulls/60
bjw-s
pushed a commit
to bjw-s-labs/action-actionlint
that referenced
this pull request
Jun 2, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.3`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](actions/checkout@v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Amsterdam) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMDUuMyIsInVwZGF0ZWRJblZlciI6IjQzLjIwNS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwicmVub3ZhdGUvZ2l0aHViLXJlbGVhc2UiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.bjw-s.dev/bjw-s/action-actionlint/pulls/3
doonga
pushed a commit
to greyrock-labs/home-ops
that referenced
this pull request
Jun 2, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.3`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](actions/checkout@v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/New_York) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMDYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIwNi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwicmVub3ZhdGUvZ2l0aHViLXJlbGVhc2UiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.greyrock.io/greyrock-labs/home-ops/pulls/178
renovate Bot
added a commit
to sdwilsh/sOS
that referenced
this pull request
Jun 2, 2026
##### [\`v6.0.3\`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) - Fix checkout init for SHA-256 repositories by [@yaananth](https://github.com/yaananth) in [#2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@yaananth](https://github.com/yaananth) in [#2414](actions/checkout#2414) --- ##### [\`v6.0.2\`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) - Fix tag handling: preserve annotations and explicit fetch-tags by [@ericsciple](https://github.com/ericsciple) in [#2356](actions/checkout#2356) --- ##### [\`v6.0.1\`](actions/checkout@v6.0.0...v6.0.1) --- ##### [\`v6.0.0\`](actions/checkout@v5.0.1...v6.0.0) --- ##### [\`v6\`]()
1 task
onap-github
pushed a commit
to onap/portal-ng-bff
that referenced
this pull request
Jun 3, 2026
Bumps actions/checkout from 6.0.2 to 6.0.3. ## Release notes Sourced from actions/checkout's releases. v6.0.3 What's Changed Update changelog by @ericsciple in actions/checkout#2357 fix: expand merge commit SHA regex and add SHA-256 test cases by @yaananth in actions/checkout#2414 Fix checkout init for SHA-256 repositories by @yaananth in actions/checkout#2439 Update changelog for v6.0.3 by @yaananth in actions/checkout#2446 New Contributors @yaananth made their first contribution in actions/checkout#2414 Full Changelog: actions/checkout@v6...v6.0.3 ## Changelog Sourced from actions/checkout's changelog. Changelog v6.0.3 Fix checkout init for SHA-256 repositories by @yaananth in actions/checkout#2439 fix: expand merge commit SHA regex and add SHA-256 test cases by @yaananth in actions/checkout#2414 v6.0.2 Fix tag handling: preserve annotations and explicit fetch-tags by @ericsciple in actions/checkout#2356 v6.0.1 Add worktree support for persist-credentials includeIf by @ericsciple in actions/checkout#2327 v6.0.0 Persist creds to a separate file by @ericsciple in actions/checkout#2286 Update README to include Node.js 24 support details and requirements by @salmanmkc in actions/checkout#2248 v5.0.1 Port v6 cleanup to v5 by @ericsciple in actions/checkout#2301 v5.0.0 Update actions checkout to use node 24 by @salmanmkc in actions/checkout#2226 v4.3.1 Port v6 cleanup to v4 by @ericsciple in actions/checkout#2305 v4.3.0 docs: update README.md by @motss in actions/checkout#1971 Add internal repos for checking out multiple repositories by @mouismail in actions/checkout#1977 Documentation update - add recommended permissions to Readme by @benwells in actions/checkout#2043 Adjust positioning of user email note and permissions heading by @joshmgross in actions/checkout#2044 Update README.md by @nebuk89 in actions/checkout#2194 Update CODEOWNERS for actions by @TingluoHuang in actions/checkout#2224 Update package dependencies by @salmanmkc in actions/checkout#2236 v4.2.2 url-helper.ts now leverages well-known environment variables by @jww3 in actions/checkout#1941 Expand unit test coverage for isGhes by @jww3 in actions/checkout#1946 v4.2.1 Check out other refs/* by commit if provided, fall back to ref by @orhantoy in actions/checkout#1924 v4.2.0 Add Ref and Commit outputs by @lucacome in actions/checkout#1180 Dependency updates by @dependabot- actions/checkout#1777, actions/checkout#1872 v4.1.7 Bump the minor-npm-dependencies group across 1 directory with 4 updates by @dependabot in actions/checkout#1739 Bump actions/checkout from 3 to 4 by @dependabot in actions/checkout#1697 Check out other refs/* by commit by @orhantoy in actions/checkout#1774 ... (truncated) ## Commits df4cb1c Update changelog for v6.0.3 (#2446) 1cce339 Fix checkout init for SHA-256 repositories (#2439) 900f221 fix: expand merge commit SHA regex and add SHA-256 test cases (#2414) 0c366fd Update changelog (#2357) See full diff in compare view  Issue-ID: CIMAN-33 Signed-off-by: dependabot[bot] <support@github.com> Change-Id: Ib3e2359f174f37230d2386c441500eb37e4c95c5 GitHub-PR: #96 GitHub-Hash: 9442dfccd711df1f Signed-off-by: onap.gh2gerrit <releng+onap-gh2gerrit@linuxfoundation.org>
onap-github
pushed a commit
to onap/portal-ng
that referenced
this pull request
Jun 3, 2026
Bumps actions/checkout from 6.0.2 to 6.0.3. ## Release notes Sourced from actions/checkout's releases. v6.0.3 What's Changed Update changelog by @ericsciple in actions/checkout#2357 fix: expand merge commit SHA regex and add SHA-256 test cases by @yaananth in actions/checkout#2414 Fix checkout init for SHA-256 repositories by @yaananth in actions/checkout#2439 Update changelog for v6.0.3 by @yaananth in actions/checkout#2446 New Contributors @yaananth made their first contribution in actions/checkout#2414 Full Changelog: actions/checkout@v6...v6.0.3 ## Changelog Sourced from actions/checkout's changelog. Changelog v6.0.3 Fix checkout init for SHA-256 repositories by @yaananth in actions/checkout#2439 fix: expand merge commit SHA regex and add SHA-256 test cases by @yaananth in actions/checkout#2414 v6.0.2 Fix tag handling: preserve annotations and explicit fetch-tags by @ericsciple in actions/checkout#2356 v6.0.1 Add worktree support for persist-credentials includeIf by @ericsciple in actions/checkout#2327 v6.0.0 Persist creds to a separate file by @ericsciple in actions/checkout#2286 Update README to include Node.js 24 support details and requirements by @salmanmkc in actions/checkout#2248 v5.0.1 Port v6 cleanup to v5 by @ericsciple in actions/checkout#2301 v5.0.0 Update actions checkout to use node 24 by @salmanmkc in actions/checkout#2226 v4.3.1 Port v6 cleanup to v4 by @ericsciple in actions/checkout#2305 v4.3.0 docs: update README.md by @motss in actions/checkout#1971 Add internal repos for checking out multiple repositories by @mouismail in actions/checkout#1977 Documentation update - add recommended permissions to Readme by @benwells in actions/checkout#2043 Adjust positioning of user email note and permissions heading by @joshmgross in actions/checkout#2044 Update README.md by @nebuk89 in actions/checkout#2194 Update CODEOWNERS for actions by @TingluoHuang in actions/checkout#2224 Update package dependencies by @salmanmkc in actions/checkout#2236 v4.2.2 url-helper.ts now leverages well-known environment variables by @jww3 in actions/checkout#1941 Expand unit test coverage for isGhes by @jww3 in actions/checkout#1946 v4.2.1 Check out other refs/* by commit if provided, fall back to ref by @orhantoy in actions/checkout#1924 v4.2.0 Add Ref and Commit outputs by @lucacome in actions/checkout#1180 Dependency updates by @dependabot- actions/checkout#1777, actions/checkout#1872 v4.1.7 Bump the minor-npm-dependencies group across 1 directory with 4 updates by @dependabot in actions/checkout#1739 Bump actions/checkout from 3 to 4 by @dependabot in actions/checkout#1697 Check out other refs/* by commit by @orhantoy in actions/checkout#1774 ... (truncated) ## Commits df4cb1c Update changelog for v6.0.3 (#2446) 1cce339 Fix checkout init for SHA-256 repositories (#2439) 900f221 fix: expand merge commit SHA regex and add SHA-256 test cases (#2414) 0c366fd Update changelog (#2357) See full diff in compare view  Issue-ID: CIMAN-33 Signed-off-by: dependabot[bot] <support@github.com> Change-Id: I0de7b562d12e51882bd8759fa5f832830d96b8dd GitHub-PR: #4 GitHub-Hash: b374d11a891e26a1 Signed-off-by: onap.gh2gerrit <releng+onap-gh2gerrit@linuxfoundation.org>
eleboucher
pushed a commit
to eleboucher/homelab
that referenced
this pull request
Jun 3, 2026
…ckout (v6.0.2 ➔ v6.0.3) (#799) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [https://data.forgejo.org/actions/checkout](https://data.forgejo.org/actions/checkout) | action | patch | `v6.0.2` → `v6.0.3` | --- ### Release Notes <details> <summary>actions/checkout (https://data.forgejo.org/actions/checkout)</summary> ### [`v6.0.3`](https://data.forgejo.org/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](https://data.forgejo.org/actions/checkout/compare/v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@​yaananth](https://github.com/yaananth) in [#​2439](actions/checkout#2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@​yaananth](https://github.com/yaananth) in [#​2414](actions/checkout#2414) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9naXRodWItYWN0aW9uIiwidHlwZS9wYXRjaCJdfQ==--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/799
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes github/actions-runtime#5528 by initializing checkout's local Git repository with the object format used by the target repository.
SHA-256 repositories fail today because checkout creates the local repository with plain
git initbefore fetching. Plaingit initcreates a SHA-1 repository by default, so the later fetch from a SHA-256 remote fails with a client/server object-format mismatch unless the workflow manually setsGIT_DEFAULT_HASH=sha256.This PR updates checkout to:
git initGET /repos/{owner}/{repo}/hash-algorithmgit init --object-format=sha256only when the repository is identified as SHA-256git initbehavior for SHA-1 repositories and for cases where the format is not identifiedWhy this approach
Checkout has to choose the local repository object format before the first fetch. The hash-algorithm endpoint uses the existing action token through Octokit and works before a
.gitdirectory exists, so it supports private repositories without setting up Git credential config early.The endpoint returns
hash_algorithmassha1orsha256. Checkout uses that value directly instead of inferring the repository format from a branch commit SHA.When checkout already has a 40- or 64-character commit SHA, it can determine the object format from that SHA without an API request. Otherwise, object-format detection is one pre-init API request to the hash-algorithm endpoint.
Checkout only opts into SHA-256 initialization after a positive SHA-256 result; otherwise it preserves the existing initialization path.
Security notes
The pre-init detection uses the existing Octokit/API authentication path and does not require writing Git credentials before repository initialization. Normal checkout authentication still happens through the existing auth helper flow, including the existing cleanup behavior for
persist-credentials: false.Validation
npm run buildnpm test -- --runInBandnpm run format-checknpm run lintGET /repos/{owner}/{repo}/hash-algorithmrequest andsha1/sha256responses