Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vilmibm
Copy link
Contributor

@vilmibm vilmibm commented May 7, 2020

This PR adds "light" interactive reviewing; ie still a top-level review but with prompts for review type and adding a body via your editor.

review

Fixes #434

@vilmibm vilmibm changed the title light interactive pr review [WIP] light interactive pr review May 7, 2020
@vilmibm vilmibm force-pushed the survey-review branch 2 times, most recently from 79229b8 to f94fc4b Compare May 8, 2020 15:26
@vilmibm vilmibm changed the title [WIP] light interactive pr review light interactive pr review May 8, 2020
@vilmibm vilmibm marked this pull request as ready for review May 8, 2020 18:53
Copy link
Contributor

@ampinsk ampinsk left a comment

Choose a reason for hiding this comment

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

Yayay I'm excited about this one, it's looking great! ✨ Left some specific comments below :)

"Comment",
"Approve",
"Request Changes",
"Cancel",
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we nix the Cancel option in the first prompt? I think this muddies up that question and you can cancel by saying no at the submit step.

Copy link
Contributor

@probablycorey probablycorey left a comment

Choose a reason for hiding this comment

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

Just played around with this and it works great. But there was one area that was a bit clunky. If I request changes or want to leave a comment it gives me two choices; edit in editor or skip. But only edit in editor is valid.

CleanShot 2020-05-08 at 17 02 38@2x

But maybe it is a better flow than automatically opening up an editor without explaining to the user why the editor opened?

}
}

if input == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

input confused me a bit here. reivewData, reviewContents might make it more clear.

Also, I realize input wasn't introduced in this PR, so it doesn't have to be changed in this PR.

@tierninho
Copy link
Contributor

  • Do we want affirmation when a user selects Cancel or selects No when the submit prompt is shown? I noticed it isn't present here but we show "Discarding." when a user abandons gh issue create.
  • If a user does this command gh pr review 13 -b test on their own PR, we should immediately show the failed to create review: Can not approve your own pull request and not wait until the user goes through the steps. Note, we show the error immediately when the -a flag is used.
  • For both the -c and -r flags, I got "accepts at most 1 arg(s), received 2". Is there any example I can follow?
  • The user can skip the comment section, but ultimately needs to fill it out else they have to start over. Is this because we cannot easily strip out enter to skip option?
  • Are we supporting line breaks?
    Screen Shot 2020-05-08 at 2 18 07 PM
  • I attempted to use -b but it didn't seen to carry through the the body of the comment or review. Any tips?
  • An affirmation message would be great if a PR was successfully approved or commented or reviewed.
  • How is a review different than a comment?

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Works well, but also ran into what @tierninho was describing: the -b flag was ignored unless -a, -r, or -c were passed. Perhaps any flag passed should trigger non-interactive mode and immediately error out on invalid combination of arguments (e.g. -b alone would be invalid).

return nil, err
}

fmt.Fprintf(out, "Got:\n%s", renderedBody)
Copy link
Contributor

Choose a reason for hiding this comment

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

Was printing the preview of the review body intended in the final product? We don't do that in issue/pr create, so doing it here looks odd. Also, the user has just seen this text because they've authored it in their text editor, so what would be the intended purpose of printing it out right after?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we've discussed doing it for pr/issue as a review step. I thought this was a good opportunity to try it out.

@vilmibm
Copy link
Contributor Author

vilmibm commented May 11, 2020

@probablycorey I updated GhEditor to support a BlankAllowed property; if set to false, the "enter to skip" behavior is disabled.

Copy link
Contributor Author

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

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

radical

@vilmibm
Copy link
Contributor Author

vilmibm commented May 11, 2020

@tierninho

  • Do we want affirmation when a user selects Cancel or selects No when the submit prompt is shown? I noticed it isn't present here but we show "Discarding." when a user abandons gh issue create.

Good idea, added a discarding message.

  • If a user does this command gh pr review 13 -b test on their own PR, we should immediately show the failed to create review: Can not approve your own pull request and not wait until the user goes through the steps. Note, we show the error immediately when the -a flag is used.

Fixed.

  • For both the -c and -r flags, I got "accepts at most 1 arg(s), received 2". Is there any example I can follow?

Can you paste what you ran? sounds like you were missing the -b?

  • The user can skip the comment section, but ultimately needs to fill it out else they have to start over. Is this because we cannot easily strip out enter to skip option?

Fixed

  • Are we supporting line breaks?

Yes, but it's markdown-rendered. Two adjacent lines in markdown are joined into one paragraph. A blank line is needed between them.

  • I attempted to use -b but it didn't seen to carry through the the body of the comment or review. Any tips?

-b is only to be used in conjunction with -a/-c/-r.

  • An affirmation message would be great if a PR was successfully approved or commented or reviewed.

Fixed

  • How is a review different than a comment?

They are two separate concepts on github.com.

@vilmibm
Copy link
Contributor Author

vilmibm commented May 11, 2020

I've taken care of all the feedback and none of the new code is very involved so I'm going to go ahead and merge~

@vilmibm vilmibm merged commit a7bcfff into master May 11, 2020
@tierninho
Copy link
Contributor

Thanks for all the fixes!

Can you paste what you ran? sounds like you were missing the -b?

Yes, I was not including the -b, so we can ignore.

@mislav mislav deleted the survey-review branch June 25, 2020 14:37
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.

Ability to review a pull request

5 participants