diff --git a/README.md b/README.md index 2006ebfff..4bae32a5d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ | `teams` | only if `assignees` is not specified | Comma separated list of teams. Issue will be assigned to the team members. | | `numOfAssignee` | false | Number of assignees that will be randomly picked from the teams or assignees. If not specified, assigns all users. | +**Important Requirement** +If using the `teams` input parameter, you need to use a personal access token with `read:org` scope (the default `GITHUB_TOKEN` is not enough). + ## Examples Here's an example flow that auto-assigns all new issues to two users randomly chosen from `octocat`, `cat` and `dog` : @@ -38,6 +41,7 @@ This other configuration assigns issues to a random member of the `support` team - name: 'Auto-assign issue' uses: pozil/auto-assign-issue@v1.3.0 with: + repo-token: ${{ secrets.MY_PERSONAL_ACCESS_TOKEN }} teams: support numOfAssignee: 1 ``` diff --git a/src/__tests__/action.test.js b/src/__tests__/action.test.js index ae897906d..1a84c8d92 100644 --- a/src/__tests__/action.test.js +++ b/src/__tests__/action.test.js @@ -5,8 +5,8 @@ const { } = require('../action.js'); const TEAMS_MEMBERS = { - teamA: [{ login: 'userA1' }, { login: 'userA2' }], - teamB: [{ login: 'userB1' }] + teamA: { data: [{ login: 'userA1' }, { login: 'userA2' }] }, + teamB: { data: [{ login: 'userB1' }] } }; const CONTEXT_PAYLOAD = { repository: { full_name: 'mockOrg/mockRepo' }, diff --git a/src/action.js b/src/action.js index 903c6756f..182b43daf 100644 --- a/src/action.js +++ b/src/action.js @@ -25,6 +25,7 @@ const getTeamMembers = async (octokit, org, teamNames) => { throw newErr; }); return teamMemberRequests + .map((response) => response.data) .reduce((all, cur) => all.concat(cur), []) .map((user) => user.login); };