diff --git a/.github/scripts/bot-gfi-assign-on-comment.js b/.github/scripts/bot-gfi-assign-on-comment.js index 80f0bb361..e08462a25 100644 --- a/.github/scripts/bot-gfi-assign-on-comment.js +++ b/.github/scripts/bot-gfi-assign-on-comment.js @@ -31,7 +31,9 @@ function commentRequestsAssignment(body) { */ function issueIsGoodFirstIssue(issue) { const labels = issue?.labels?.map(label => label.name) ?? []; - const isGfi = labels.includes(GOOD_FIRST_ISSUE_LABEL); + const isGfi = labels.some(label => + typeof label === 'string' && label.toLowerCase() === GOOD_FIRST_ISSUE_LABEL.toLowerCase() + ); console.log('[gfi-assign] issueIsGoodFirstIssue:', { labels, @@ -201,6 +203,25 @@ module.exports = async ({ github, context }) => { }); console.log('[gfi-assign] Assignment completed successfully'); + + // Chain mentor assignment after successful GFI assignment + try { + const assignMentor = require('./bot-mentor-assignment.js'); + await assignMentor({ + github, + context, + assignee: { login: requesterUsername, type: 'User' } // Pass freshly-assigned username + }); + console.log('[gfi-assign] Mentor assignment chained successfully'); + } catch (error) { + console.error('[gfi-assign] Mentor assignment failed but user assignment succeeded:', { + message: error.message, + status: error.status, + issueNumber: context.payload.issue?.number, + assignee: requesterUsername, + }); + // Don't throw error - user assignment was successful + } } catch (error) { console.error('[gfi-assign] Error:', { message: error.message, diff --git a/.github/scripts/bot-mentor-assignment.js b/.github/scripts/bot-mentor-assignment.js index 8726047a4..358d27954 100644 --- a/.github/scripts/bot-mentor-assignment.js +++ b/.github/scripts/bot-mentor-assignment.js @@ -128,10 +128,10 @@ Happy building! — Python SDK Team`; } -module.exports = async ({ github, context }) => { +module.exports = async ({ github, context, assignee: passedAssignee }) => { try { const issue = context.payload.issue; - const assignee = context.payload.assignee; + const assignee = passedAssignee || context.payload.assignee; if (!issue?.number || !assignee?.login) { return console.log('No issue or assignee found in payload. Skipping.'); diff --git a/.github/workflows/bot-mentor-assignment.yml b/.github/workflows/archive/bot-mentor-assignment.yml similarity index 100% rename from .github/workflows/bot-mentor-assignment.yml rename to .github/workflows/archive/bot-mentor-assignment.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index c0347c783..ba30c41ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1. - Added workflow to prevent assigning intermediate issues to contributors without prior Good First Issue completion (#1143). - 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)] - Improved unit test coverage for `TransactionId` class, covering parsing logic, hashing, and scheduled transactions. +- 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) ### Changed - Added global review instructions to CodeRabbit configuration to limit reviews to issue/PR scope and prevent scope creep [#1373]