Add result to github output

This commit is contained in:
agobrech 2023-05-22 11:56:24 +02:00
parent 8c0670749d
commit 84c4b1b3a5

View file

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-loop-func */ /* eslint-disable @typescript-eslint/no-loop-func */
import fs from 'fs'; import fs from 'fs';
import os from 'os';
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { ITaskData } from 'n8n-workflow'; import type { ITaskData } from 'n8n-workflow';
import { sleep } from 'n8n-workflow'; import { sleep } from 'n8n-workflow';
@ -497,12 +498,19 @@ export class ExecuteBatch extends BaseCommand {
result.slackMessage = `*${result.summary.errors.length} Executions errors*`; result.slackMessage = `*${result.summary.errors.length} Executions errors*`;
console.log(result.slackMessage); console.log(result.slackMessage);
} }
this.setOutput('slackMessage', JSON.stringify(result.slackMessage));
} }
console.log(result);
res(result); res(result);
}); });
} }
setOutput(key: string, value: any) {
// Temporary hack until we move to the new action.
const output = process.env.GITHUB_OUTPUT;
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
fs.appendFileSync(output as unknown as fs.PathOrFileDescriptor, `${key}=${value}${os.EOL}`);
}
updateStatus() { updateStatus() {
if (ExecuteBatch.cancelled) { if (ExecuteBatch.cancelled) {
return; return;