mirror of
https://github.com/actions/checkout.git
synced 2024-12-22 23:55:47 +02:00
in input-helper, add validation to commit input
Signed-off-by: James Bradlee <james.bradlee@telenor.no>
This commit is contained in:
parent
8a241b5b4d
commit
267ca9cee1
1 changed files with 4 additions and 0 deletions
|
@ -58,6 +58,10 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
|||
|
||||
// Source branch, source version
|
||||
result.commit = core.getInput('commit')
|
||||
if (result.commit && !result.commit.match(/^[0-9a-fA-F]{40}$/)) {
|
||||
throw new Error(`The commit SHA '${result.commit}' is not a valid SHA.`)
|
||||
}
|
||||
|
||||
result.ref = core.getInput('ref') ?? result.commit
|
||||
if (!result.ref) {
|
||||
if (isWorkflowRepository) {
|
||||
|
|
Loading…
Reference in a new issue