Skip to content

Commit

Permalink
Fix logs for action
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Sep 24, 2023
1 parent 518dcf6 commit b5ba689
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/containers/action/ActionRunnerContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class ActionRunnerContainer extends Container {
private generatedFileService: FileContentService;
private userConfigService: UserConfigService;
private tempFileService: FileContentService;
private isErr = false;

async init(engine: ContainerEngine): Promise<void> {
await super.init(engine);
Expand Down Expand Up @@ -238,6 +239,8 @@ export class ActionRunnerContainer extends Container {

const ownerRepo = await gitScanner.getOwnerRepo();

this.isErr = false;

const actionDefs = await this.convertActionYaml(config.actions_yaml);
for (const actionDef of actionDefs) {
if (actionDef.on !== this.params['trigger']) {
Expand Down Expand Up @@ -282,6 +285,7 @@ export class ActionRunnerContainer extends Container {
break;
}
if (0 !== lastCode) {
this.isErr = true;
break;
}
}
Expand Down Expand Up @@ -310,4 +314,8 @@ export class ActionRunnerContainer extends Container {
}
return additionalEnv;
}

public failed() {
return this.isErr;
}
}
3 changes: 3 additions & 0 deletions src/containers/job/JobManagerContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ export class JobManagerContainer extends Container {
await this.engine.registerContainer(runActionContainer);
try {
await runActionContainer.run(folderId);
if (runActionContainer.failed()) {
throw new Error('One on action steps has failed');
}
} finally {
fs.rmSync(tempPath, { recursive: true, force: true });
await this.engine.unregisterContainer(runActionContainer.params.name);
Expand Down

0 comments on commit b5ba689

Please sign in to comment.