mirror of
https://github.com/actions/checkout
synced 2024-11-10 07:32:39 +00: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
|
// Source branch, source version
|
||||||
result.commit = core.getInput('commit')
|
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
|
result.ref = core.getInput('ref') ?? result.commit
|
||||||
if (!result.ref) {
|
if (!result.ref) {
|
||||||
if (isWorkflowRepository) {
|
if (isWorkflowRepository) {
|
||||||
|
|
Loading…
Reference in a new issue