3
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-08-22 04:37:52 +00:00
This commit is contained in:
James Bradlee 2025-07-23 21:01:22 +07:00 committed by GitHub
commit 0539876ac1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 2 deletions

View file

@ -57,7 +57,12 @@ export async function getInputs(): Promise<IGitSourceSettings> {
`${github.context.repo.owner}/${github.context.repo.repo}`.toUpperCase()
// Source branch, source version
result.ref = core.getInput('ref')
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) {
result.ref = github.context.ref