mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-18 01:42:34 +00:00
fix: use async/await in the runner
This commit is contained in:
parent
cd7e423dd8
commit
e300660370
2 changed files with 14 additions and 13 deletions
18
src/index.ts
18
src/index.ts
|
|
@ -2,14 +2,16 @@ import * as core from '@actions/core';
|
|||
import Input from './input';
|
||||
import Renovate from './renovate';
|
||||
|
||||
function run(): Promise<void> {
|
||||
const input = new Input();
|
||||
const renovate = new Renovate(input.configurationFile, input.token);
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const input = new Input();
|
||||
const renovate = new Renovate(input.configurationFile, input.token);
|
||||
|
||||
return renovate.runDockerContainer();
|
||||
await renovate.runDockerContainer();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
console.error(error);
|
||||
core.setFailed(error.message);
|
||||
});
|
||||
run();
|
||||
|
|
|
|||
|
|
@ -19,18 +19,17 @@ class Renovate {
|
|||
this.docker = new Docker();
|
||||
}
|
||||
|
||||
runDockerContainer(): Promise<void> {
|
||||
async runDockerContainer(): Promise<void> {
|
||||
const commandArguments = [
|
||||
'run',
|
||||
'--rm',
|
||||
`--env ${this.configFileEnv}=${this.configFileMountPath()}`,
|
||||
`--env ${this.tokenEnv}=${this.token}`,
|
||||
`--volume ${this.configFile}:${this.configFileMountPath()}`,
|
||||
this.docker.image(),
|
||||
];
|
||||
const command = `docker`;
|
||||
|
||||
const code = exec(command, commandArguments);
|
||||
const command = `docker run ${commandArguments.join(' ')}`;
|
||||
|
||||
const code = await exec(command);
|
||||
if (code !== 0) {
|
||||
new Error(`'docker run' failed with exit code ${code}.`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue