Skip to content

Commit

Permalink
fixed match is broken after switch to Regex dev-drprasad#34
Browse files Browse the repository at this point in the history
  • Loading branch information
smallprogram committed Sep 29, 2023
1 parent 6f01477 commit 9de8192
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ async function deleteOlderReleases(keepLatest, keepMinDownloadCount, deleteExpir
data = releasesData || [];

const activeMatchedReleases = data.filter((item) => {
if (deletePrereleaseOnly) {
return !item.draft && item.tag_name.match(deletePattern) !== -1 && item.assets.length > 0 && item.prerelease;
} else {
return !item.draft && item.tag_name.match(deletePattern) !== -1 && item.assets.length > 0;
}
})
const shouldDelete = deletePrereleaseOnly && deletePatternStr;
const isDraft = item.draft;
const hasAssets = item.assets.length > 0;
const isPrerelease = item.prerelease;
const isTagMatching = deletePatternStr ? item.tag_name.match(deletePattern) : true;

return !isDraft && hasAssets && (shouldDelete ? (isTagMatching && isPrerelease) : true);
});

if (activeMatchedReleases.length === 0) {
console.log(`😕 no active releases found. exiting...`);
Expand Down

0 comments on commit 9de8192

Please sign in to comment.