mirror of
https://github.com/yangskyboxlabs/action-checkout.git
synced 2025-12-13 21:18:25 +01:00
Add objectFormat setting to allow init()ing a repo with sha256
This commit is contained in:
parent
9a9194f871
commit
85f76c73cb
4 changed files with 20 additions and 7 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
|
@ -711,9 +711,13 @@ class GitCommandManager {
|
||||||
getWorkingDirectory() {
|
getWorkingDirectory() {
|
||||||
return this.workingDirectory;
|
return this.workingDirectory;
|
||||||
}
|
}
|
||||||
init() {
|
init(options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
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() {
|
isDetached() {
|
||||||
|
|
@ -1238,7 +1242,7 @@ function getSource(settings) {
|
||||||
// Initialize the repository
|
// Initialize the repository
|
||||||
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
||||||
core.startGroup('Initializing the repository');
|
core.startGroup('Initializing the repository');
|
||||||
yield git.init();
|
yield git.init({ objectFormat: settings.objectFormat });
|
||||||
yield git.remoteAdd('origin', repositoryUrl);
|
yield git.remoteAdd('origin', repositoryUrl);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export interface IGitCommandManager {
|
||||||
): Promise<void>
|
): Promise<void>
|
||||||
getDefaultBranch(repositoryUrl: string): Promise<string>
|
getDefaultBranch(repositoryUrl: string): Promise<string>
|
||||||
getWorkingDirectory(): string
|
getWorkingDirectory(): string
|
||||||
init(): Promise<void>
|
init(options?: { objectFormat?: string }): Promise<void>
|
||||||
isDetached(): Promise<boolean>
|
isDetached(): Promise<boolean>
|
||||||
lfsFetch(ref: string): Promise<void>
|
lfsFetch(ref: string): Promise<void>
|
||||||
lfsInstall(): Promise<void>
|
lfsInstall(): Promise<void>
|
||||||
|
|
@ -327,8 +327,12 @@ class GitCommandManager {
|
||||||
return this.workingDirectory
|
return this.workingDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(): Promise<void> {
|
async init(options?: { objectFormat?: string }): Promise<void> {
|
||||||
await this.execGit(['init', this.workingDirectory])
|
await this.execGit([
|
||||||
|
'init',
|
||||||
|
...(options?.objectFormat ? [`--object-format=${options.objectFormat}`] : []),
|
||||||
|
this.workingDirectory
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDetached(): Promise<boolean> {
|
async isDetached(): Promise<boolean> {
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
|
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
|
||||||
) {
|
) {
|
||||||
core.startGroup('Initializing the repository')
|
core.startGroup('Initializing the repository')
|
||||||
await git.init()
|
await git.init({ objectFormat: settings.objectFormat })
|
||||||
await git.remoteAdd('origin', repositoryUrl)
|
await git.remoteAdd('origin', repositoryUrl)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,4 +118,9 @@ export interface IGitSourceSettings {
|
||||||
* User override on the GitHub Server/Host URL that hosts the repository to be cloned
|
* User override on the GitHub Server/Host URL that hosts the repository to be cloned
|
||||||
*/
|
*/
|
||||||
githubServerUrl: string | undefined
|
githubServerUrl: string | undefined
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object format used for the repo, if it is not default
|
||||||
|
*/
|
||||||
|
objectFormat: string | undefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue