Skip to content

Commit a1747d6

Browse files
committed
Enhance release comment handler with detailed logging and bot filtering improvements
1 parent 9d77de1 commit a1747d6

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

.github/workflows/release-comment-handler.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@ on:
66
- labeled
77

88
jobs:
9-
comment_on_label:
9+
comment // Convert Set to array and filter out bots
10+
const all_users_before_filter = Array.from(all_participants);
11+
console.log(`All participants before bot filtering: ${all_users_before_filter.join(', ')}`);
12+
13+
const all_users = all_users_before_filter.filter(user => !isBotUser(user));
14+
15+
const filteredBots = all_users_before_filter.filter(user => isBotUser(user));
16+
console.log(`Filtered out ${filteredBots.length} bot users: ${filteredBots.join(', ')}`);
17+
console.log(`Final participants count: ${all_users.length}`);
18+
console.log(`Final participants: ${all_users.join(', ')}`);
19+
20+
// Debug each user's bot status
21+
all_users_before_filter.forEach(user => {
22+
const isBot = isBotUser(user);
23+
console.log(`User "${user}" - isBot: ${isBot}`);
24+
});el:
1025
if: github.event.label.name == 'prerelease' || github.event.label.name == 'fixed'
1126
runs-on: ubuntu-latest
1227
permissions:
@@ -18,6 +33,7 @@ jobs:
1833
uses: actions/github-script@v7
1934
with:
2035
script: |
36+
console.log("=== WORKFLOW START ===");
2137
const issue_number = context.payload.issue.number;
2238
const repo = context.repo;
2339
@@ -36,16 +52,21 @@ jobs:
3652
console.log(`Added author to participants: ${author.toLowerCase()}`);
3753
3854
// Get all comments and add commenters
55+
console.log("=== FETCHING COMMENTS ===");
3956
const comments = await github.paginate(
4057
github.rest.issues.listComments,
4158
{ ...repo, issue_number }
4259
);
4360
console.log(`Found ${comments.length} comments`);
4461
45-
comments.forEach(c => {
62+
if (comments.length === 0) {
63+
console.log("❌ NO COMMENTS FOUND - This might be why no users are tagged");
64+
}
65+
66+
comments.forEach((c, index) => {
4667
const commenter = c.user.login.toLowerCase();
4768
all_participants.add(commenter);
48-
console.log(`Added commenter: ${commenter}`);
69+
console.log(`Comment #${index + 1}: Added commenter: ${commenter} (original: ${c.user.login})`);
4970
});
5071
5172
// Get all reactions from comments
@@ -82,9 +103,16 @@ jobs:
82103
83104
// Filter out bot users
84105
const isBotUser = (username) => {
85-
return username.endsWith('[bot]') ||
86-
username.includes('bot') ||
87-
['dependabot', 'renovate', 'greenkeeper', 'codecov', 'coveralls'].includes(username.toLowerCase());
106+
const lowerUsername = username.toLowerCase();
107+
return lowerUsername.endsWith('[bot]') ||
108+
lowerUsername === 'dependabot' ||
109+
lowerUsername === 'renovate' ||
110+
lowerUsername === 'greenkeeper' ||
111+
lowerUsername === 'codecov' ||
112+
lowerUsername === 'coveralls' ||
113+
lowerUsername.startsWith('dependabot[') ||
114+
lowerUsername.includes('-bot') ||
115+
lowerUsername.includes('_bot');
88116
};
89117
90118
// Convert Set to array and filter out bots
@@ -102,14 +130,21 @@ jobs:
102130
103131
const mentions = all_users.map(u => `@${u}`).join(' ');
104132
console.log(`Generated mentions: ${mentions}`);
133+
console.log(`Setting output 'mentions' to: "${mentions}"`);
105134
106-
return { mentions };
135+
return { mentions: mentions };
107136
result-encoding: string
108137

109138
- name: Add label comment
110139
uses: actions/github-script@v7
111140
with:
112141
script: |
142+
console.log("=== STEP 2: ADD COMMENT ===");
143+
console.log("Raw step output access test:");
144+
console.log("steps.participants:", JSON.stringify('${{steps.participants}}', null, 2));
145+
console.log("steps.participants.outputs:", JSON.stringify('${{steps.participants.outputs}}', null, 2));
146+
console.log("steps.participants.outputs.mentions:", '${{steps.participants.outputs.mentions}}');
147+
113148
const mentions = '${{steps.participants.outputs.mentions}}';
114149
const labelName = context.payload.label.name;
115150

0 commit comments

Comments
 (0)