Skip to content

[Intermediate]: Expand mentor assignment comment so it actually assigns a mentor #1719

@exploreriii

Description

@exploreriii

🧩 Intermediate Contributors

This issue is intended for contributors who already have some familiarity with the
Hiero Python SDK codebase and contribution workflow.

You should feel comfortable:

  • navigating existing source code and examples
  • understanding SDK concepts without step-by-step guidance
  • following the standard PR workflow without additional onboarding

If this is your very first contribution to the project, we recommend starting with a few
Good First Issues before working on this one.

🐞 Problem Description

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

this COMMENTS on a new good first issue starter, that they are assigned a mentor.

To help streamline our SDK, it would be better if the mentor is ASSIGNED to the issue, as well as the comment getting posted

💡 Expected Solution

Edit .github/scripts/bot-mentor-assignment.js ensure a mentor gets assigned, not just commented

🧠 Implementation Notes

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

we first will recognise that this is a qualified new starter that we want to assign a mentor

  • immediately add a label 'mentor-duty'
  • Assign the mentor second
  • post the comment on success

ensure:

const MENTOR_DUTY_LABEL = process.env.MENTOR_DUTY_LABEL || 'mentor-duty';

ADDITIONALLY you'll need to edit:
.github/scripts/bot-gfi-assign-on-comment.js
.github/scripts/bot-beginner-assign-on-comment.js

both these issues should check mentor assignment does not count to their open assignments
i.e. more like this

async function getOpenAssignments({ github, owner, repo, username }) {
    const permissionResp = await github.rest.repos.getCollaboratorPermissionLevel({
        owner,
        repo,
        username,
    });

    const permission = permissionResp.data.permission;

    const issues = await github.paginate(
        github.rest.issues.listForRepo,
        {
            owner,
            repo,
            assignee: username,
            state: 'open',
            per_page: 100,
        }
    );

    return issues.filter(issue => {
        const isPR = !!issue.pull_request;
        if (isPR) return false; // Never count PRs

        const labels = issue.labels?.map(l => l.name) || [];

        if (permission === 'triage' && labels.includes('mentor-duty')) {
            return false; // Mentor work shouldn't count
        }

        return true;
    }).length;
}

This is ranked as an intermediate issue as there are a few bits depending on our triage and mentor logic, so care and tests need to be done

✅ Acceptance Criteria

To merge this issue, the pull request must:

  • Fully address the problem described above
  • Follow existing project conventions and patterns
  • Include tests or example updates where appropriate
  • Pass all CI checks
  • Include a valid changelog entry
  • be a DCO and GPG key signed as git commit -S -s -m "chore: my change" with a GPG key set up

📚 Additional Context or Resources

Metadata

Metadata

Assignees

Labels

github_actionsPull requests that update Github Actions code.intermediaterequires some knowledge of the codebase with some defined steps to implement or examples

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions