Skip to content

Commit 4c9f247

Browse files
authored
Added better check to verify runs to be deleted, and some logging
1 parent 2068295 commit 4c9f247

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dist/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ async function run() {
6464

6565
// Creates the delete runs array, and adds the runs that don't have a workflow associated with it
6666
let del_runs = new Array();
67-
del_runs = all_runs.filter(
68-
({ workflow_id }) => {
69-
return workflow_ids.some(w => w === workflow_id);
67+
for (const run of all_runs) {
68+
if (!workflow_ids.includes(run.workflow_id)) {
69+
del_runs.push(run);
70+
core.debug(` Added to del list '${run.name}' workflow run ${run.id}`);
7071
}
71-
);
72+
}
7273

74+
console.log(`💬 found total of ${del_runs.length} workflow run(s)`);
75+
// is attempting to delete the existing workflow. Means the filtering logic is wrong
7376
for (const del of del_runs) {
7477
core.debug(`Deleting '${del.name}' workflow run ${del.id}`);
7578
// Execute the API "Delete a workflow run", see 'https://octokit.github.io/rest.js/v18#actions-delete-workflow-run'

0 commit comments

Comments
 (0)