fix: expand SHA regex to support SHA-256 (64-char) commit hashes#2413
Draft
yaananth wants to merge 1 commit intoactions:mainfrom
Draft
fix: expand SHA regex to support SHA-256 (64-char) commit hashes#2413yaananth wants to merge 1 commit intoactions:mainfrom
yaananth wants to merge 1 commit intoactions:mainfrom
Conversation
Update input-helper.ts to recognize both 40-char (SHA-1) and 64-char (SHA-256) hex strings as commit SHAs. Rebuild dist/index.js. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
salmanmkc
reviewed
Apr 15, 2026
| } | ||
| // SHA? | ||
| else if (result.ref.match(/^[0-9a-fA-F]{40}$/)) { | ||
| else if (result.ref.match(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)) { |
Contributor
There was a problem hiding this comment.
the existing test at __test__/input-helper.test.ts line 129–134 only covers 40-char SHA inputs, can we add one for 64-char SHAs to correctly identity it as a commit and that it's not treated as a branch. e.g.:
it('sets ref to empty when explicit sha-256', async () => { inputs.ref = '1111111111222222222233333333334444444444555555555566666666667777' const settings = await inputHelper.getInputs() expect(settings.ref).toBeFalsy() expect(settings.commit).toBe('1111111111222222222233333333334444444444555555555566666666667777') })
Contributor
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
Update
input-helper.tsto recognize both 40-char (SHA-1) and 64-char (SHA-256) hex strings as commit SHAs. Rebuilddist/index.js.Changes
src/input-helper.ts: Update regex from/^[0-9a-fA-F]{40}$/to/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/dist/index.js: Rebuilt bundleValidation
npm run build)npm test)Context
Automated by
project-board-agents-pluginvia/project-board-agents:leadBoard: https://github.com/orgs/github/projects/24272/views/1
Item: [P0] Fix SHA-1 regex in actions/checkout input-helper.ts
Run: sha256-p0-checkout-00050