Forcefully set pre stage and setup job status to success, remove complete job
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
39
src/act.ts
39
src/act.ts
@@ -459,7 +459,6 @@ export class Act {
|
|||||||
let jobIndex = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!
|
let jobIndex = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!
|
||||||
.findIndex(job => job.name === jobName);
|
.findIndex(job => job.name === jobName);
|
||||||
if (jobIndex < 0) {
|
if (jobIndex < 0) {
|
||||||
|
|
||||||
// Add new job with setup step
|
// Add new job with setup step
|
||||||
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!.push({
|
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!.push({
|
||||||
name: jobName,
|
name: jobName,
|
||||||
@@ -481,20 +480,40 @@ export class Act {
|
|||||||
jobIndex = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!.length - 1;
|
jobIndex = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs!.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCompleteJobStep = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps!.length > 1;
|
// TODO: Add complete job step. To be fixed with https://github.com/nektos/act/issues/2551
|
||||||
if (parsedMessage.stepID || isCompleteJobStep) {
|
// const isCompleteJobStep = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps!.length > 1;
|
||||||
|
// if (parsedMessage.stepID || isCompleteJobStep) {
|
||||||
|
// let stepName: string;
|
||||||
|
// let stepId: string;
|
||||||
|
// if (!parsedMessage.stepID && isCompleteJobStep) {
|
||||||
|
// stepName = 'Complete Job';
|
||||||
|
// stepId = "--complete-job"; // Special Id for complete job
|
||||||
|
// } else {
|
||||||
|
// stepName = parsedMessage.stage !== 'Main' ? `${parsedMessage.stage} ${parsedMessage.step}` : parsedMessage.step;
|
||||||
|
// stepId = parsedMessage.stepID[0];
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (parsedMessage.stepID) {
|
||||||
let stepName: string;
|
let stepName: string;
|
||||||
let stepId: string;
|
const stepId: string = parsedMessage.stepID[0];
|
||||||
if (!parsedMessage.stepID && isCompleteJobStep) {
|
if (parsedMessage.stage !== 'Main') {
|
||||||
stepName = 'Complete Job';
|
stepName = `${parsedMessage.stage} ${parsedMessage.step}`;
|
||||||
stepId = "--complete-job"; // Special Id for complete job
|
|
||||||
} else {
|
} else {
|
||||||
stepName = parsedMessage.stage !== 'Main' ? `${parsedMessage.stage} ${parsedMessage.step}` : parsedMessage.step;
|
stepName = parsedMessage.step;
|
||||||
stepId = parsedMessage.stepID[0];
|
|
||||||
|
// TODO: This forcefully sets any pre step to success. To be fixed with https://github.com/nektos/act/issues/2551
|
||||||
|
const preStepName = `Pre ${parsedMessage.step}`;
|
||||||
|
let preStepIndex = this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps!
|
||||||
|
.findIndex(step => step.id === stepId && step.name === preStepName);
|
||||||
|
if (this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![preStepIndex].status === HistoryStatus.Running) {
|
||||||
|
|
||||||
|
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![preStepIndex].status = HistoryStatus.Success;
|
||||||
|
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![preStepIndex].date.end = dateString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].status === HistoryStatus.Running) {
|
if (this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].status === HistoryStatus.Running) {
|
||||||
// TODO: How to know if setup job step failed?
|
// TODO: This forcefully sets the setup job step to success. To be fixed with https://github.com/nektos/act/issues/2551
|
||||||
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].status = HistoryStatus.Success;
|
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].status = HistoryStatus.Success;
|
||||||
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].date.end = dateString;
|
this.historyManager.workspaceHistory[commandArgs.path][historyIndex].jobs![jobIndex].steps![0].date.end = dateString;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user