mirror of
https://github.com/actions/checkout.git
synced 2026-11-17 07:06:28 +08:00
set the commit output when falling back to the REST API
When Git is not available on the runner, getSource() downloads the repository using the REST API and returns early, before the commit output is set. The ref output is still set by main.ts after getSource() returns, so the step reports a ref but an empty commit, even though action.yml documents commit unconditionally. Set the output from the resolved settings on that path. The REST API fallback does not create a local Git repository, so git log -1 cannot be used there.
This commit is contained in:
parent
f548e57e54
commit
7282dbb854
3 changed files with 197 additions and 0 deletions
3
dist/index.js
vendored
3
dist/index.js
vendored
|
|
@ -41755,6 +41755,9 @@ async function getSource(settings) {
|
|||
throw new Error(`Input 'ssh-key' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH.`);
|
||||
}
|
||||
await downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
|
||||
// Set the commit output. The REST API fallback does not create a local
|
||||
// Git repository, so the SHA can only come from the resolved settings.
|
||||
setOutput('commit', settings.commit);
|
||||
return;
|
||||
}
|
||||
// Save state for POST action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue