From baa578c20a2319c13ff6c81fdefba6f692acd354 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:02:06 +0100 Subject: [PATCH] add invalid / wontdo check --- .github/workflows/changelog-pr.yml | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/changelog-pr.yml b/.github/workflows/changelog-pr.yml index ad4e2c58..097fd3e7 100644 --- a/.github/workflows/changelog-pr.yml +++ b/.github/workflows/changelog-pr.yml @@ -70,22 +70,25 @@ jobs: per_page: 100, }); - pulls.filter((pr) => - pr.merged_at && new Date(pr.merged_at) > latestDateInChangelog - ).forEach((pr) => { - const prLabels = pr.labels.map((label) => label.name.toLowerCase()); - const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`; + const excludedLabels = ["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL]; - for (const { labels, notes } of categorizedPRs) { - const prHasCategoryLabel = labels.some((label) => prLabels.includes(label)); - const isUnlabelledCategory = labels.length === 0; - const prShouldBeExcluded = prLabels.includes(process.env.AUTOMATED_PR_LABEL); - if ((prHasCategoryLabel || isUnlabelledCategory) && !prShouldBeExcluded) { - notes.push(prNote); - break; - } - }; - }); +pulls.filter((pr) => + pr.merged_at && + new Date(pr.merged_at) > latestDateInChangelog && + !pr.labels.some((label) => excludedLabels.includes(label.name.toLowerCase())) +).forEach((pr) => { + const prLabels = pr.labels.map((label) => label.name.toLowerCase()); + const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`; + + for (const { labels, notes } of categorizedPRs) { + const prHasCategoryLabel = labels.some((label) => prLabels.includes(label)); + const isUnlabelledCategory = labels.length === 0; + if (prHasCategoryLabel || isUnlabelledCategory) { + notes.push(prNote); + break; + } + } +}); return categorizedPRs;