mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-24 12:25:34 +00:00
Add objectFormat setting to allow init()ing a repo with sha256
This commit is contained in:
parent
85e6279cec
commit
b9de40a228
9 changed files with 81 additions and 8 deletions
18
dist/index.js
vendored
18
dist/index.js
vendored
|
@ -709,9 +709,13 @@ class GitCommandManager {
|
|||
getWorkingDirectory() {
|
||||
return this.workingDirectory;
|
||||
}
|
||||
init() {
|
||||
init(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.execGit(['init', this.workingDirectory]);
|
||||
yield this.execGit([
|
||||
'init',
|
||||
...((options === null || options === void 0 ? void 0 : options.objectFormat) ? [`--object-format=${options.objectFormat}`] : []),
|
||||
this.workingDirectory
|
||||
]);
|
||||
});
|
||||
}
|
||||
isDetached() {
|
||||
|
@ -1236,7 +1240,7 @@ function getSource(settings) {
|
|||
// Initialize the repository
|
||||
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
||||
core.startGroup('Initializing the repository');
|
||||
yield git.init();
|
||||
yield git.init({ objectFormat: settings.objectFormat });
|
||||
yield git.remoteAdd('origin', repositoryUrl);
|
||||
core.endGroup();
|
||||
}
|
||||
|
@ -1831,6 +1835,14 @@ function getInputs() {
|
|||
// Determine the GitHub URL that the repository is being hosted from
|
||||
result.githubServerUrl = core.getInput('github-server-url');
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`);
|
||||
// Object format
|
||||
const objectFormat = core.getInput('object-format');
|
||||
if (objectFormat) {
|
||||
if (objectFormat != 'sha1' && objectFormat != 'sha256') {
|
||||
throw Error(`Invalid object format '${objectFormat}'`);
|
||||
}
|
||||
result.objectFormat = objectFormat;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue