forked from necojackarc/auto-request-review
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit dc3795b
authored
Use Issues/Timelines API to retrieve all previously requested reviewers (#4)
The previous PR (#3) attempted to skip re-assigning aliases that had previously been assigned to the pull request.
Based on [the github documentation](https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#get-all-requested-reviewers-for-a-pull-request), the previous API will only return current aliases that have been requested for review. This breaks two scenarios:
1) user aliases that have previously signed off will not be returned (and therefore re-added)
2) team aliases that have been signed off "on behalf of" a user alias will not be returned (they get removed entirely from the PR) (and therefore re-added).
This PR moves to using [the timelineevents API](https://docs.github.com/en/rest/issues/timeline?apiVersion=2022-11-28#about-timeline-events) which will give us every alias that has been requested regardless of their current status. Because the `timeline` can have a lot of events and the REST version doesn't allow us to filter, I opted to both swap to using [GraphQL version](https://docs.github.com/en/graphql/reference/unions#pullrequesttimelineitems) and added [pagination support.](https://github.com/octokit/plugin-paginate-graphql.js/?tab=readme-ov-file#usage).
The final change is to Unit Tests where we pull in [rewire](https://github.com/jhnns/rewire) in order to mock private methods of our `github.js` file. Primarily due to issues with mocking a constructor now that we had to [change the instantiation of octokit](https://github.com/actions/toolkit/tree/main/packages/github#extending-the-octokit-instance).1 parent d8fc68e commit dc3795bCopy full SHA for dc3795b
File tree
7 files changed
+3311
-1186
lines changed- dist
- src
- test
7 files changed
+3311
-1186
lines changed
0 commit comments