1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-05-10 03:49:55 +02:00

Add support for SHA256 repositories

New input parameter to specify the git object format when initializing a
git repository.
This commit is contained in:
Elisei Roca 2025-04-05 11:11:19 +02:00
parent 85e6279cec
commit 488933c971
No known key found for this signature in database
GPG key ID: 9B47732BAA663196
8 changed files with 37 additions and 8 deletions

14
dist/index.js vendored
View file

@ -709,9 +709,14 @@ class GitCommandManager {
getWorkingDirectory() {
return this.workingDirectory;
}
init() {
init(objectFormat) {
return __awaiter(this, void 0, void 0, function* () {
yield this.execGit(['init', this.workingDirectory]);
const args = ['init'];
if (objectFormat) {
args.push(`--object-format=${objectFormat}`);
}
args.push(this.workingDirectory);
yield this.execGit(args);
});
}
isDetached() {
@ -1236,7 +1241,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(settings.objectFormat);
yield git.remoteAdd('origin', repositoryUrl);
core.endGroup();
}
@ -1831,6 +1836,9 @@ 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}`);
// Retrieve the Git object format for initializing a Git repository.
result.objectFormat = core.getInput('object-format');
core.debug(`git object format = ${result.objectFormat}`);
return result;
});
}