Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yipstanley committed Aug 11, 2020
1 parent 07656e4 commit a590d27
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
MATCH_GIT_DIFF_FILE_NAME,
MATCH_GIT_DIFF_FILE_SEPERATOR,
} from './constants';
import {ownerAndRepo, context, extraPermGithub} from './setup';

type Section = 'pull_request' | 'push';
type GeraldFile = 'NOTIFIED' | 'REVIEWERS';
Expand Down Expand Up @@ -75,6 +76,23 @@ const filterIgnoreFiles = (fileContents: string): Array<string> => {
});
};

export const maybeRemoveReviewRequests = async (removedJustNames: Array<string>) => {
const {data: reviewRequests} = await extraPermGithub.pulls.listReviewRequests({
...ownerAndRepo,
pull_number: context.issue.number,
});
const toRemove = reviewRequests.users
.filter(user => removedJustNames.includes(user.login))
.map(user => user.login);
if (toRemove.length) {
await extraPermGithub.pulls.deleteReviewRequest({
...ownerAndRepo,
pull_number: context.issue.number,
reviewers: toRemove,
});
}
};

/**
* @desc Read ./.geraldignore and ./.gitignore if they exist.
* Split the files by newlines to serve as the list of files/directories to
Expand Down

1 comment on commit a590d27

@khan-actions-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notify of Push Without Pull Request

@yipstanley for changes to src/utils.js

Please sign in to comment.