Skip to content

Commit f6bc769

Browse files
ci: use MAINTAINERS.json to check for core maintainers in thank you action
1 parent d699d7e commit f6bc769

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/thank-you.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,38 @@ on:
77

88
permissions:
99
pull-requests: write
10+
contents: read
1011

1112
jobs:
1213
thank-you:
1314
# Only run if the PR was actually merged
1415
if: github.event.pull_request.merged
1516
runs-on: ubuntu-latest
1617
steps:
18+
# We must check out the code to read the MAINTAINERS.json file
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
1722
- name: Leave a Thank You Comment
1823
uses: actions/github-script@v7
1924
with:
2025
script: |
26+
const fs = require('fs');
2127
const creator = context.payload.pull_request.user.login;
22-
const association = context.payload.pull_request.author_association;
2328
2429
// Skip bots to avoid comment loops
2530
if (creator.endsWith('[bot]')) {
2631
console.log('Skipping bot account.');
2732
return;
2833
}
2934
35+
// Read maintainers list from JSON file
36+
const maintainersData = JSON.parse(fs.readFileSync('MAINTAINERS.json', 'utf8'));
37+
const maintainers = maintainersData.maintainers.map(m => m.toLowerCase());
38+
3039
// Skip core maintainers to avoid spamming the team
31-
const ignoreAssociations = ['MEMBER', 'OWNER', 'COLLABORATOR'];
32-
if (ignoreAssociations.includes(association)) {
33-
console.log(`Skipping maintainer account (Association: ${association}).`);
40+
if (maintainers.includes(creator.toLowerCase())) {
41+
console.log(`Skipping maintainer account: ${creator}`);
3442
return;
3543
}
3644

MAINTAINERS.json

Whitespace-only changes.

0 commit comments

Comments
 (0)