-
Notifications
You must be signed in to change notification settings - Fork 37
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
Prompt for unchanged or empty PR description #130
Conversation
in manual testing this is now working as expected, but it needs to be improved on and the tests updated |
@@ -68,6 +71,15 @@ func run(c *cobra.Command, _ []string) { | |||
readCampaignActivity.EndWithFailure(err) | |||
return | |||
} | |||
prDescriptionUnchanged, err := campaign.PrDescriptionUnchanged(dir) |
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.
Could we perhaps rename the function to IsPrDescriptionUnchanged
? Unless there is any precedent in other boolean-returning functions?
} | ||
|
||
func PrDescriptionUnchanged(dir *Campaign) (bool, error) { | ||
tempPrDescriptionFile, err := os.Create("turbolift-temp-pr-description-*") |
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.
Could we make this work without creating a new file? e.g. if applyTemplate
accepted an io.Writer
or a buffer instead of a file, and file creation were moved out of it.
Then this function could avoid creating a new file, and instead just read the real file and compare its string contents...
this was unnecessarily complicated, closing in favour of #145 |
To deal with #124
Also adds a missing test for creating PRs with custom description file.
In order to test whether the PR description has been changed, I had to reuse the method that creates the README.md on
turbolift init
, but with a temporary file. For this to work it was necessary to move some functionality out of init and into campaign.