Skip to content

Commit fa4c3ff

Browse files
authored
chore: Chain GFI assignment with mentor assignment (#1369) (#1386)
Signed-off-by: Mounil <mounilkankhara@gmail.com>
1 parent 89afede commit fa4c3ff

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.github/scripts/bot-gfi-assign-on-comment.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ function commentRequestsAssignment(body) {
3131
*/
3232
function issueIsGoodFirstIssue(issue) {
3333
const labels = issue?.labels?.map(label => label.name) ?? [];
34-
const isGfi = labels.includes(GOOD_FIRST_ISSUE_LABEL);
34+
const isGfi = labels.some(label =>
35+
typeof label === 'string' && label.toLowerCase() === GOOD_FIRST_ISSUE_LABEL.toLowerCase()
36+
);
3537

3638
console.log('[gfi-assign] issueIsGoodFirstIssue:', {
3739
labels,
@@ -201,6 +203,25 @@ module.exports = async ({ github, context }) => {
201203
});
202204

203205
console.log('[gfi-assign] Assignment completed successfully');
206+
207+
// Chain mentor assignment after successful GFI assignment
208+
try {
209+
const assignMentor = require('./bot-mentor-assignment.js');
210+
await assignMentor({
211+
github,
212+
context,
213+
assignee: { login: requesterUsername, type: 'User' } // Pass freshly-assigned username
214+
});
215+
console.log('[gfi-assign] Mentor assignment chained successfully');
216+
} catch (error) {
217+
console.error('[gfi-assign] Mentor assignment failed but user assignment succeeded:', {
218+
message: error.message,
219+
status: error.status,
220+
issueNumber: context.payload.issue?.number,
221+
assignee: requesterUsername,
222+
});
223+
// Don't throw error - user assignment was successful
224+
}
204225
} catch (error) {
205226
console.error('[gfi-assign] Error:', {
206227
message: error.message,

.github/scripts/bot-mentor-assignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ Happy building!
128128
— Python SDK Team`;
129129
}
130130

131-
module.exports = async ({ github, context }) => {
131+
module.exports = async ({ github, context, assignee: passedAssignee }) => {
132132
try {
133133
const issue = context.payload.issue;
134-
const assignee = context.payload.assignee;
134+
const assignee = passedAssignee || context.payload.assignee;
135135

136136
if (!issue?.number || !assignee?.login) {
137137
return console.log('No issue or assignee found in payload. Skipping.');
File renamed without changes.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
8787
- Added workflow to prevent assigning intermediate issues to contributors without prior Good First Issue completion (#1143).
8888
- Added `Client.from_env()` and network-specific factory methods (e.g., `Client.for_testnet()`) to simplify client initialization and reduce boilerplate. [[#1251](https://github.com/hiero-ledger/hiero-sdk-python/issues/1251)]
8989
- Improved unit test coverage for `TransactionId` class, covering parsing logic, hashing, and scheduled transactions.
90+
- Chained Good First Issue assignment with mentor assignment to bypass GitHub's anti-recursion protection - mentor assignment now occurs immediately after successful user assignment in the same workflow execution. (#1369)
9091

9192
### Changed
9293
- Added global review instructions to CodeRabbit configuration to limit reviews to issue/PR scope and prevent scope creep [#1373]

0 commit comments

Comments
 (0)