Skip to content

Commit

Permalink
adress review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rayane-d committed Apr 29, 2024
1 parent 47adcd9 commit aa13921
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/failureNotifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ jobs:
repo: context.repo.repo,
workflow_id: 'preDeploy.yml',
});
const run = allRuns.data.workflow_runs.find(run => run.id === runId);
const run_number = run.run_number;
const previousRun = allRuns.data.workflow_runs.find(run => run.run_number === run_number - 1);
if (previousRun.actor.login === 'OSBotify') {
return allRuns.data.workflow_runs.find(run => run.run_number === run_number - 2);
}
const filteredRuns = allRuns.data.workflow_runs.filter(run => run.actor.login !== 'OSBotify' && run.status !== 'cancelled');
const currentIndex = filteredRuns.findIndex(run => run.id === runId);
const previousRun = filteredRuns[currentIndex + 1];
return previousRun;
- name: Fetch Previous Workflow Run Jobs
Expand Down Expand Up @@ -84,8 +81,7 @@ jobs:
const jobName = jobs.jobs[i].name;
const jobLink = jobs.jobs[i].html_url;
const previousJob = previousRunJobs.jobs.find(job => job.name === jobName);
previousJobSucceeded = previousJob.conclusion === 'success';
if (previousJobSucceeded) {
if (previousJob?.conclusion === 'success') {
const annotations = await github.rest.checks.listAnnotations({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit aa13921

Please sign in to comment.