Skip to content

Commit

Permalink
Fix same_content_new bug (runs would be inappropriately skipped) (#125)
Browse files Browse the repository at this point in the history
* Fix same_content_new bug (runs would be inappropriately skipped)

Context: #124

* Add compiled js
  • Loading branch information
smklein committed Jul 27, 2021
1 parent 867de26 commit f75dd65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
22 changes: 10 additions & 12 deletions dist/index.js
Expand Up @@ -10064,20 +10064,18 @@ function detectConcurrentRuns(context) {
exitSuccess({ shouldSkip: true });
}
}
else if (context.concurrentSkipping === "same_content" || context.concurrentSkipping === "same_content_newer") {
else if (context.concurrentSkipping === "same_content") {
const concurrentDuplicate = concurrentRuns.find((run) => run.treeHash === context.currentRun.treeHash);
if (concurrentDuplicate) {
if (context.concurrentSkipping === "same_content") {
core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
}
else if (context.concurrentSkipping === "same_content_newer") {
const concurrentIsOlder = concurrentRuns.find((run) => run.runNumber < context.currentRun.runNumber);
if (concurrentIsOlder) {
core.info(`Skip execution because the exact same files are concurrently checked in older ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
}
}
core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
}
}
else if (context.concurrentSkipping === "same_content_newer") {
const concurrentIsOlder = concurrentRuns.find((run) => (run.treeHash === context.currentRun.treeHash) && (run.runNumber < context.currentRun.runNumber));
if (concurrentIsOlder) {
core.info(`Skip execution because the exact same files are concurrently checked in older ${concurrentIsOlder.html_url}`);
exitSuccess({ shouldSkip: true });
}
}
core.info(`Did not find any skippable concurrent workflow-runs`);
Expand Down
20 changes: 9 additions & 11 deletions src/index.ts
Expand Up @@ -230,19 +230,17 @@ function detectConcurrentRuns(context: WRunContext) {
core.info(`Skip execution because a newer instance of the same workflow is running in ${newerRun.html_url}`);
exitSuccess({ shouldSkip: true });
}
} else if (context.concurrentSkipping === "same_content" || context.concurrentSkipping === "same_content_newer") {
} else if (context.concurrentSkipping === "same_content") {
const concurrentDuplicate = concurrentRuns.find((run) => run.treeHash === context.currentRun.treeHash);
if (concurrentDuplicate) {
if (context.concurrentSkipping === "same_content") {
core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
} else if (context.concurrentSkipping === "same_content_newer") {
const concurrentIsOlder = concurrentRuns.find((run) => run.runNumber < context.currentRun.runNumber);
if (concurrentIsOlder) {
core.info(`Skip execution because the exact same files are concurrently checked in older ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
}
}
core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`);
exitSuccess({ shouldSkip: true });
}
} else if (context.concurrentSkipping === "same_content_newer") {
const concurrentIsOlder = concurrentRuns.find((run) => (run.treeHash === context.currentRun.treeHash) && (run.runNumber < context.currentRun.runNumber));
if (concurrentIsOlder) {
core.info(`Skip execution because the exact same files are concurrently checked in older ${concurrentIsOlder.html_url}`);
exitSuccess({ shouldSkip: true });
}
}
core.info(`Did not find any skippable concurrent workflow-runs`);
Expand Down

0 comments on commit f75dd65

Please sign in to comment.