-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
There was a problem hiding this comment.
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.` |
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: { |
There was a problem hiding this comment.
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. :)
@Priyansh61 do you plan to continue with this one? |
1 similar comment
@Priyansh61 do you plan to continue with this one? |
Description
This action is used to call the reviewer to review the PR using the command /review
or /rerequest.
/review @user1 @user2
this will call only user1 and user2 to review the PR/review
this will call all the requested reviewers to review the PRProof of Work
rerequest-2023-05-27_15.40.50.mp4
Related issue(s)
Resolves #211