Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added /review /rerequest command to get reviews from the reviewers #243

Closed
wants to merge 4 commits into from

Conversation

Priyansh61
Copy link
Contributor

Description
This action is used to call the reviewer to review the PR using the command /review
or /rerequest.

  • If the user is not mentioned, then all the reviewers are called to review the PR.
  • If the user is mentioned, then only those users are called to review the PR.
  • e.g. /review @user1 @user2 this will call only user1 and user2 to review the PR
  • e.g. /review this will call all the requested reviewers to review the PR

Proof of Work

rerequest-2023-05-27_15.40.50.mp4

Related issue(s)

Resolves #211

Copy link
Member

Choose a reason for hiding this comment

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

Can you please document these commands here as well?

- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`

Comment on lines +34 to +63
const comment = context.payload.comment.body;
const prDetailsUrl = context.payload.issue.pull_request.url;
const { data : pull} = await github.request(prDetailsUrl);
const pullRequestId = pull.node_id;
const reviewers = pull.requested_reviewers.map(reviewer => reviewer.login);
const userIDregex = /@([A-Za-z0-9-]+)/g;
const userIDmatches = comment.match(userIDregex);
var userIdArray = [];
if (userIDmatches){
// If user is mentioned, then add only those users
// Remove the @ from the user name
for (const user of userIDmatches) {
const userId = user.substring(1);
userIdArray.push(userId);
}
}
else {
// If no user is mentioned, then add all the reviewers
userIdArray = reviewers;
}
const userIdNodeArray = [];
for (const user of userIdArray) {
const { data } = await github.request(`https://api.github.com/users/${user}`);
const userId = data.node_id;
userIdNodeArray.push(userId);
}
if (userIdNodeArray.length > 0) {
const mutationQuery = `
mutation {
requestReviews(input: {
Copy link
Member

@KhudaDad414 KhudaDad414 Jun 2, 2023

Choose a reason for hiding this comment

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

some logs would be great so it becomes easier to debug. :)

@derberg
Copy link
Member

derberg commented Jun 28, 2023

@Priyansh61 do you plan to continue with this one?

1 similar comment
@derberg
Copy link
Member

derberg commented Feb 21, 2024

@Priyansh61 do you plan to continue with this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need another command for PRs which acts as re-request for review and also reminder for codeowners
3 participants