auto-assign
auto-assign copied to clipboard
feat(reviewersInTeams): using teams to add reviews
- Using GitHub teams you can specify reviewers to be added to Pull Request
- GitHub team's slug name is used under the label reviewersInTeams to extract the members in the team
Fixes https://github.com/kentaro-m/auto-assign/issues/123
Hi, @itomtom! Thanks for adding a new feature. I have reviewed it.
This change needs the scope of members
to call GitHub Teams API.
c.f. https://developer.github.com/v3/apps/permissions/#permission-on-members
https://github.com/kentaro-m/auto-assign/blob/master/app.yml#L105
members: read
Also, I have checked your changes in my local environment and failed unit tests. I think I need to update the new version of the Probot.

https://github.com/probot/probot/pull/1128
$ cd auto-assign
$ rm -rf node_modules
$ npm install
$ npm update probot --save
diff --git a/package.json b/package.json
index 5cfa772..dd01781 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"@types/lodash": "^4.14.119",
"@types/node": "^10.12.18",
"lodash": "^4.17.15",
- "probot": "^9.6.3",
+ "probot": "^9.11.3",
"typescript": "^3.7.2"
},
"devDependencies": {
I have not done a detailed review yet, so I will continue to check it.
Is this PR stale?
I'm just waiting for further reviews as I made an update push on 21st April.
Hi, @itomtom.
Building these codes and running unit tests are failed in my environment (Node.js v12.18.3). How it behaves in your environment?
~/workspace/github.com/kentaro-m/auto-assign ttruong/feat/reviewersInTeams 19s
β― npm run build
> [email protected] build /Users/kentarom/workspace/github.com/kentaro-m/auto-assign
> tsc -p tsconfig.json
src/handler.ts:27:34 - error TS2339: Property 'listMembersInOrg' does not exist on type '{ addMember: { (params?: (RequestOptions & TeamsAddMemberParams) | undefined): Promise<Response<TeamsAddMemberResponse>>; endpoint: Endpoint; }; ... 32 more ...; updateDiscussionComment: { ...; }; }'.
27 await context.github.teams.listMembersInOrg({
~~~~~~~~~~~~~~~~
src/handler.ts:57:36 - error TS2339: Property 'listMembersLegacy' does not exist on type '{ addMember: { (params?: (RequestOptions & TeamsAddMemberParams) | undefined): Promise<Response<TeamsAddMemberResponse>>; endpoint: Endpoint; }; ... 32 more ...; updateDiscussionComment: { ...; }; }'.
57 await context.github.teams.listMembersLegacy({
~~~~~~~~~~~~~~~~~
Found 2 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc -p tsconfig.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kentarom/.npm/_logs/2020-08-14T16_09_27_437Z-debug.log
~/workspace/github.com/kentaro-m/auto-assign ttruong/feat/reviewersInTeams
β― npm test
> [email protected] test /Users/kentarom/workspace/github.com/kentaro-m/auto-assign
> jest
PASS test/util.test.ts
FAIL test/handler.test.ts
β Test suite failed to run
TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
test/handler.test.ts:943:50 - error TS2345: Argument of type '"listMembersLegacy"' is not assignable to parameter of type '"create" | "get" | "list" | "listForAuthenticatedUser" | "update" | "addMember" | "addOrUpdateMembership" | "addOrUpdateProject" | "addOrUpdateRepo" | "checkManagesRepo" | ... 23 more ... | "updateDiscussionComment"'.
943 const spy = jest.spyOn(context.github.teams, 'listMembersLegacy')
~~~~~~~~~~~~~~~~~~~
Test Suites: 1 failed, 1 passed, 2 total
Tests: 15 passed, 15 total
Snapshots: 0 total
Time: 2.387s, estimated 3s
Ran all test suites.
npm ERR! Test failed. See above for more details.