Skip to content

Commit

Permalink
Ignore inconsistent runs that have a status set to 'in_progress' but …
Browse files Browse the repository at this point in the history
…conclusion is 'success'
  • Loading branch information
gustaff-weldon committed Apr 21, 2023
1 parent ca99add commit 446f151
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ async function run() {
try {
const input = parseInput(env);
debug(
`Parsed inputs (w/o token): ${(({ githubToken, ...inputs }) => inputs)(
input
)}`
`Parsed inputs (w/o token): ${(({ githubToken, ...inputs }) =>
JSON.stringify(inputs))(input)}`
);
const github = new OctokitGitHub(input.githubToken);
debug(`Fetching workflows for ${input.owner}/${input.repo}...`);
Expand Down
11 changes: 11 additions & 0 deletions src/wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ export class Waiter implements Wait {
this.debug(`Found ${runs.length} ${this.workflowId} runs`);
const previousRuns = runs
.filter((run) => run.id < this.input.runId)
.filter((run) => {
const isSuccessful: boolean = run.conclusion === "success";

if (isSuccessful) {
this.debug(
`Skipping run ${run.id}, status: ${run.status}, conclusion: ${run.conclusion}`
);
}

return !isSuccessful;
})
.sort((a, b) => b.id - a.id);
if (!previousRuns || !previousRuns.length) {
setOutput("force_continued", "");
Expand Down

0 comments on commit 446f151

Please sign in to comment.