diff --git a/packages/project-management-automation/lib/add-first-time-contributor-label.js b/packages/project-management-automation/lib/add-first-time-contributor-label.js index e185acbd46c4b6..81f42ccc0dcb0a 100644 --- a/packages/project-management-automation/lib/add-first-time-contributor-label.js +++ b/packages/project-management-automation/lib/add-first-time-contributor-label.js @@ -17,12 +17,12 @@ async function addFirstTimeContributorLabel( payload, octokit ) { debug( `add-first-time-contributor-label: Searching for commits in ${ owner }/${ repo } by @${ author }` ); - const { total_count: totalCount } = await octokit.search.commits( { + const { data: { total_count: totalCount } } = await octokit.search.commits( { q: `repo:${ owner }/${ repo }+author:${ author }`, } ); if ( totalCount !== 0 ) { - debug( 'add-first-time-contributor-label: Commits found. Aborting' ); + debug( `add-first-time-contributor-label: ${ totalCount } commits found. Aborting` ); return; } diff --git a/packages/project-management-automation/lib/test/add-first-time-contributor-label.js b/packages/project-management-automation/lib/test/add-first-time-contributor-label.js index 91eeb56dca339d..ef7f65bf0909fe 100644 --- a/packages/project-management-automation/lib/test/add-first-time-contributor-label.js +++ b/packages/project-management-automation/lib/test/add-first-time-contributor-label.js @@ -22,7 +22,11 @@ describe( 'addFirstTimeContributorLabel', () => { it( 'does nothing if the user has commits', async () => { const octokit = { search: { - commits: jest.fn( () => Promise.resolve( { total_count: 100 } ) ), + commits: jest.fn( () => Promise.resolve( { + data: { + total_count: 100, + }, + } ) ), }, issues: { addLabels: jest.fn(), @@ -40,7 +44,11 @@ describe( 'addFirstTimeContributorLabel', () => { it( 'adds the label if the user does not have commits', async () => { const octokit = { search: { - commits: jest.fn( () => Promise.resolve( { total_count: 0 } ) ), + commits: jest.fn( () => Promise.resolve( { + data: { + total_count: 0, + }, + } ) ), }, issues: { addLabels: jest.fn(),