Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ function getInputs() {
}
}
// 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})$/)) {
result.commit = result.ref;
result.ref = '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/input-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function getInputs(): Promise<IGitSourceSettings> {
}
}
// 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})$/)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')
})

result.commit = result.ref
result.ref = ''
}
Expand Down
Loading