diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 1e7b035ffb75df0cd0a412031999b81aad8525dc..f2ff4ccae7c56d91b6771531cab7a689d1d12750 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -866,12 +866,19 @@ async function addAssignees(issueNo, assignees) { async function addReviewers(prNo, reviewers) { logger.debug(`Adding reviewers ${reviewers} to #${prNo}`); + + const userReviewers = reviewers.filter(e => !e.startsWith('team:')); + const teamReviewers = reviewers + .filter(e => e.startsWith('team:')) + .map(e => e.replace(/^team:/, '')); + await get.post( `repos/${config.parentRepo || config.repository}/pulls/${prNo}/requested_reviewers`, { body: { - reviewers, + reviewers: userReviewers, + team_reviewers: teamReviewers, }, } ); diff --git a/test/platform/github/__snapshots__/index.spec.js.snap b/test/platform/github/__snapshots__/index.spec.js.snap index bef71803ecf61cf94a81bf83e57adbc56d4fe92a..96b73e6303dfa893fa3c447991b4fdca680d06e3 100644 --- a/test/platform/github/__snapshots__/index.spec.js.snap +++ b/test/platform/github/__snapshots__/index.spec.js.snap @@ -26,6 +26,9 @@ Array [ "someuser", "someotheruser", ], + "team_reviewers": Array [ + "someteam", + ], }, }, ], diff --git a/test/platform/github/index.spec.js b/test/platform/github/index.spec.js index c0d6582f2e6326963aa6f4100347a984f47b53fe..50b0b0fdd954dd5681668513e6407cce4d3e063f 100644 --- a/test/platform/github/index.spec.js +++ b/test/platform/github/index.spec.js @@ -1050,7 +1050,11 @@ describe('platform/github', () => { repository: 'some/repo', }); get.post.mockReturnValueOnce({}); - await github.addReviewers(42, ['someuser', 'someotheruser']); + await github.addReviewers(42, [ + 'someuser', + 'someotheruser', + 'team:someteam', + ]); expect(get.post.mock.calls).toMatchSnapshot(); }); }); diff --git a/website/docs/configuration-options.md b/website/docs/configuration-options.md index a1cbbe890b306dac4c1daf9b1fc709c969e53a63..75df35c4a5b3b904101ced21d7aad6f335b04d41 100644 --- a/website/docs/configuration-options.md +++ b/website/docs/configuration-options.md @@ -976,7 +976,7 @@ Similar to `ignoreUnstable`, this option controls whether to update to versions ## reviewers -Must be valid usernames. Note: does not currently work with the GitHub App due to an outstanding GitHub API bug. +Must be valid usernames. If on GitHub and assigning a team to review, use the prefix `team:`, e.g. provide a value like `team:someteam`. ## rollbackPrs