Skip to content

Commit 74605c5

Browse files
committed
chore: add mentor assignment debug logging
Signed-off-by: Mounil <[email protected]>
1 parent 9f4081b commit 74605c5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ function hasGoodFirstIssueLabel(issue) {
5858
async function isNewContributor(github, owner, repo, login) {
5959
const query = `repo:${owner}/${repo} type:pr state:closed is:merged author:${login}`;
6060

61+
const hasToken = Boolean(process.env.GITHUB_TOKEN || process.env.GH_TOKEN);
62+
console.log(`Mentor assignment search query: ${query}`);
63+
console.log(`GitHub token present: ${hasToken}`);
64+
6165
try {
6266
const response = await github.rest.search.issuesAndPullRequests({
6367
q: query,
6468
per_page: 1,
6569
});
66-
return (response.data.total_count || 0) === 0;
70+
const totalCount = response?.data?.total_count || 0;
71+
console.log(`Merged PR count for ${login}: ${totalCount}`);
72+
const isNewStarter = totalCount === 0;
73+
console.log(`Is ${login} considered a new starter? ${isNewStarter}`);
74+
return isNewStarter;
6775
} catch (error) {
6876
console.log(`Unable to determine merged PRs for ${login}:`, error.message || error);
6977
// Return null (skip assignment) on API errors to avoid workflow failure while preserving accurate logging

0 commit comments

Comments
 (0)