mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-18 01:42:34 +00:00
fix: use async/await for exec
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
parent
b435cadb65
commit
cd7e423dd8
1 changed files with 14 additions and 22 deletions
|
|
@ -20,28 +20,20 @@ class Renovate {
|
||||||
}
|
}
|
||||||
|
|
||||||
runDockerContainer(): Promise<void> {
|
runDockerContainer(): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
const commandArguments = [
|
||||||
const commandArguments = [
|
'run',
|
||||||
'--rm',
|
'--rm',
|
||||||
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
||||||
`--env ${this.tokenEnv}=${this.token}`,
|
`--env ${this.tokenEnv}=${this.token}`,
|
||||||
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
||||||
this.docker.image(),
|
this.docker.image(),
|
||||||
];
|
];
|
||||||
const command = `docker run ${commandArguments.join(' ')}`;
|
const command = `docker`;
|
||||||
|
|
||||||
exec(command)
|
const code = exec(command, commandArguments);
|
||||||
.then((code) => {
|
if (code !== 0) {
|
||||||
if (code === 0) {
|
new Error(`'docker run' failed with exit code ${code}.`);
|
||||||
resolve();
|
}
|
||||||
} else {
|
|
||||||
reject(new Error(`'docker run' failed with exit code ${code}.`));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private validateArguments(): void {
|
private validateArguments(): void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue