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

Prompt for unchanged or empty PR description #130

Closed
wants to merge 10 commits into from

Conversation

Dan7-7-7
Copy link
Collaborator

@Dan7-7-7 Dan7-7-7 commented Apr 10, 2024

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.

@Dan7-7-7
Copy link
Collaborator Author

in manual testing this is now working as expected, but it needs to be improved on and the tests updated

@Dan7-7-7 Dan7-7-7 marked this pull request as draft June 27, 2024 14:35
@Dan7-7-7 Dan7-7-7 marked this pull request as ready for review August 8, 2024 09:41
@@ -68,6 +71,15 @@ func run(c *cobra.Command, _ []string) {
readCampaignActivity.EndWithFailure(err)
return
}
prDescriptionUnchanged, err := campaign.PrDescriptionUnchanged(dir)
Copy link
Collaborator

@rnorth rnorth Aug 8, 2024

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-*")
Copy link
Collaborator

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...

@Dan7-7-7
Copy link
Collaborator Author

this was unnecessarily complicated, closing in favour of #145

@Dan7-7-7 Dan7-7-7 closed this Aug 14, 2024
@Dan7-7-7 Dan7-7-7 deleted the check_pr_description branch August 14, 2024 10:24
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.

3 participants