Skip to content

Commit b4c753d

Browse files
authored
Update mirror-changelog.yml
1 parent 75bbc5e commit b4c753d

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

.github/workflows/mirror-changelog.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ jobs:
2929
- name: Add Toolbox Release Notes to PR Body
3030
uses: actions/github-script@v6
3131
env:
32-
REQUIRED_KEYWORD: 'postgres'
32+
REQUIRED_KEYWORDS: 'postgres'
3333
with:
3434
script: |
35-
const requiredKeyword = process.env.REQUIRED_KEYWORD;
35+
const requiredKeywordsEnv = process.env.REQUIRED_KEYWORDS;
36+
const requiredKeywords = requiredKeywordsEnv.split(',').map(kw => kw.trim()).filter(kw => kw.length > 0);
37+
3638
const prBody = context.payload.pull_request.body || '';
3739
3840
// Extract the relevant changelog section
@@ -80,16 +82,19 @@ jobs:
8082
// Match and extract changelog item
8183
const itemMatch = trimmedLine.match(/^[*-]\s(.*)$/);
8284
if (itemMatch) {
83-
// Use the raw content, exactly as the original script did
8485
const originalContent = itemMatch[1];
85-
8686
const lineAsLowerCase = originalContent.toLowerCase();
87+
8788
const hasPrefix = prefixesToFilter.some(prefix => lineAsLowerCase.includes(prefix));
88-
const hasKeyword = lineAsLowerCase.includes(requiredKeyword);
8989
90-
// Include if it doesn't have a prefix OR it has the keyword
91-
if (!hasPrefix || hasKeyword) {
92-
// Use the original script's output format
90+
// Check if the line includes ANY of the required keywords
91+
let hasAnyRequiredKeyword = false;
92+
if (requiredKeywords.length > 0) {
93+
hasAnyRequiredKeyword = requiredKeywords.some(keyword => lineAsLowerCase.includes(keyword));
94+
}
95+
96+
// Include if it doesn't have a prefix OR it has any of the required keywords
97+
if (!hasPrefix || hasAnyRequiredKeyword) {
9398
newChangelog.push(`- ${currentType}: ${originalContent}`);
9499
} else {
95100
console.log(`Filtering out: ${originalContent}`);
@@ -118,7 +123,7 @@ jobs:
118123
return;
119124
}
120125
121-
// 5. Update the PR
126+
// Update the PR
122127
await github.rest.pulls.update({
123128
owner: context.repo.owner,
124129
repo: context.repo.repo,

0 commit comments

Comments
 (0)