Skip to content

Commit 1593bf5

Browse files
committed
more cleanup
1 parent 0fb7250 commit 1593bf5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

dev-packages/clear-cache-gh-action/index.mjs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,25 @@ async function clearGithubCaches(octokit, { repo, owner, clearDevelop, clearPend
107107
}
108108

109109
core.info(`> Clearing cache because latest workflow run is ${latestWorkflowRun.conclusion}.`);
110-
} else if (isPr) {
111-
// Case 2: This is a PR, but we do not want to clear pending PRs
112-
// In this case, this cache should never be cleared
113-
core.info('> Keeping cache of every PR workflow run.');
114-
return false;
115-
} else if (clearBranches) {
116-
// Case 3: This is not a PR, and we want to clean branches
110+
return true;
111+
}
112+
113+
// Case 2: This is a PR, but we do want to clear pending PRs
114+
// In this case, this cache should always be cleared
115+
if (isPr) {
116+
core.info('> Clearing cache of every PR workflow run.');
117+
return true;
118+
}
119+
120+
// Case 3: This is not a PR, and we want to clean branches
121+
if (clearBranches) {
117122
core.info('> Clearing cache because it is not a PR.');
118123
return true;
119-
} else {
120-
// Case 4: This is not a PR, and we do not want to clean branches
121-
core.info('> Keeping cache for non-PR workflow run.');
122-
return false;
123124
}
125+
126+
// Case 4: This is not a PR, and we do not want to clean branches
127+
core.info('> Keeping cache for non-PR workflow run.');
128+
return false;
124129
};
125130

126131
for await (const response of octokit.paginate.iterator(octokit.rest.actions.getActionsCacheList, {

0 commit comments

Comments
 (0)