Skip to content

Commit baa578c

Browse files
authored
add invalid / wontdo check
1 parent d8f433c commit baa578c

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

.github/workflows/changelog-pr.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,25 @@ jobs:
7070
per_page: 100,
7171
});
7272
73-
pulls.filter((pr) =>
74-
pr.merged_at && new Date(pr.merged_at) > latestDateInChangelog
75-
).forEach((pr) => {
76-
const prLabels = pr.labels.map((label) => label.name.toLowerCase());
77-
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
78-
79-
for (const { labels, notes } of categorizedPRs) {
80-
const prHasCategoryLabel = labels.some((label) => prLabels.includes(label));
81-
const isUnlabelledCategory = labels.length === 0;
82-
const prShouldBeExcluded = prLabels.includes(process.env.AUTOMATED_PR_LABEL);
83-
if ((prHasCategoryLabel || isUnlabelledCategory) && !prShouldBeExcluded) {
84-
notes.push(prNote);
85-
break;
86-
}
87-
};
88-
});
73+
const excludedLabels = ["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL];
74+
75+
pulls.filter((pr) =>
76+
pr.merged_at &&
77+
new Date(pr.merged_at) > latestDateInChangelog &&
78+
!pr.labels.some((label) => excludedLabels.includes(label.name.toLowerCase()))
79+
).forEach((pr) => {
80+
const prLabels = pr.labels.map((label) => label.name.toLowerCase());
81+
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
82+
83+
for (const { labels, notes } of categorizedPRs) {
84+
const prHasCategoryLabel = labels.some((label) => prLabels.includes(label));
85+
const isUnlabelledCategory = labels.length === 0;
86+
if (prHasCategoryLabel || isUnlabelledCategory) {
87+
notes.push(prNote);
88+
break;
89+
}
90+
}
91+
});
8992

9093
return categorizedPRs;
9194

0 commit comments

Comments
 (0)