mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-16 08:52:35 +00:00
Merge 6bc5e9d4be into 47283fac74
This commit is contained in:
commit
ee0a62b8dd
2 changed files with 27 additions and 1 deletions
|
|
@ -73,7 +73,7 @@ Specify a command to run when the image start.
|
||||||
By default the image run
|
By default the image run
|
||||||
`renovate`.
|
`renovate`.
|
||||||
This option is useful to customize the image before running `renovate`.
|
This option is useful to customize the image before running `renovate`.
|
||||||
It must be an existing executable file on the local system.
|
It must be an existing file on the local system and it must have execute permission.
|
||||||
It will be mounted to the docker container.
|
It will be mounted to the docker container.
|
||||||
|
|
||||||
For example you can create a simple script like this one (let's call it
|
For example you can create a simple script like this one (let's call it
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,11 @@ export class Renovate {
|
||||||
if (/\s/.test(this.input.token.value)) {
|
if (/\s/.test(this.input.token.value)) {
|
||||||
throw new Error('Token MUST NOT contain whitespace');
|
throw new Error('Token MUST NOT contain whitespace');
|
||||||
}
|
}
|
||||||
|
await this.validateConfigFileArgument();
|
||||||
|
await this.validateDockerCmdFileArgument();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async validateConfigFileArgument(): Promise<void> {
|
||||||
const configurationFile = this.input.configurationFile();
|
const configurationFile = this.input.configurationFile();
|
||||||
if (
|
if (
|
||||||
configurationFile !== null &&
|
configurationFile !== null &&
|
||||||
|
|
@ -125,4 +129,26 @@ export class Renovate {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async validateDockerCmdFileArgument(): Promise<void> {
|
||||||
|
const dockerCmdFile = this.input.getDockerCmdFile();
|
||||||
|
if (dockerCmdFile === null) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const s = await fs.stat(dockerCmdFile);
|
||||||
|
if (!s.isFile)
|
||||||
|
throw new Error(`dockerCmdFile '${dockerCmdFile}' MUST be a file`);
|
||||||
|
if (
|
||||||
|
(s.mode & fs.constants.R_OK) === 0 ||
|
||||||
|
(s.mode & fs.constants.X_OK) === 0
|
||||||
|
)
|
||||||
|
throw new Error(
|
||||||
|
`dockerCmdFile '${dockerCmdFile}' MUST have read and execute rights`,
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Error && 'code' in err && err.code === 'ENOENT')
|
||||||
|
throw new Error(`dockerCmdFile '${dockerCmdFile}' does not exist`);
|
||||||
|
throw new Error(err as string);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue