mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-06 11:25:33 +01:00
feat: add and enable pre-push Git hooks
This commit is contained in:
parent
c419332bad
commit
2afdf43cd2
4 changed files with 54 additions and 1 deletions
|
@ -142,6 +142,10 @@ class GenerateCommand extends Command
|
|||
if ($filesystem->exists("{$outputDir}/tools/docker/images/php/root/usr/local/bin/docker-entrypoint-php")) {
|
||||
$filesystem->chmod("{$outputDir}/tools/docker/images/php/root/usr/local/bin/docker-entrypoint-php", 0755);
|
||||
}
|
||||
|
||||
if ($filesystem->exists("{$outputDir}/.githooks/pre-push")) {
|
||||
$filesystem->chmod("{$outputDir}/.githooks/pre-push", 0755);
|
||||
}
|
||||
}
|
||||
|
||||
function getFiles(array $configurationData): Collection
|
||||
|
@ -219,6 +223,14 @@ class GenerateCommand extends Command
|
|||
);
|
||||
}
|
||||
|
||||
if (Arr::get($configurationData, 'experimental.runGitHooksBeforePush', false) === true) {
|
||||
$filesToGenerate[] = new TemplateFile(
|
||||
data: 'git-hooks/pre-push',
|
||||
name: 'pre-push',
|
||||
path: '.githooks',
|
||||
);
|
||||
}
|
||||
|
||||
return $filesToGenerate;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ final class Config
|
|||
allowMissingFields: true,
|
||||
fields: [
|
||||
'createGitHubActionsConfiguration' => new Assert\Type('boolean'),
|
||||
'runGitHooksBeforePush' => new Assert\Type('boolean'),
|
||||
'useNewDatabaseCredentials' => new Assert\Type('boolean'),
|
||||
]
|
||||
)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue