-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add option to control PR description max length + set reasonable defaults for each platform #7487
Merged
jeffwidman
merged 29 commits into
dependabot:main
from
dwc0011:dwc0011/truncate_codecommit_pr_description
Jul 25, 2023
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a237476
Add truncate_pr_description and align rescue properly in fetch_file_c…
dwc0011 06461cd
Add specs for truncate method
dwc0011 55c1ac3
use stubbed client
dwc0011 1540d6d
Use client
dwc0011 25b499e
Fix logic on comparing truncated strings
dwc0011 09ad912
Move truncate to message builder and pass in the default values if no…
dwc0011 ac9ddc5
Remove spec that was unintentionally added
dwc0011 62a8f76
Remove the old pr description tests
dwc0011 946b1eb
Reuse properly configured builder
dwc0011 6c126c7
Fix reference to undefined variable
dwc0011 7429f9e
Add setter for new fields
dwc0011 514f5e2
Fix setters
dwc0011 13d79f0
return msg
dwc0011 610cae0
Add consistency to how max length is used, create encode variable
dwc0011 0c087c1
Fix lint and add param to encode
dwc0011 a2c90e9
Remove useless ||=
dwc0011 3c9ddf5
reference instance variables correctly and add missing pr_message_enc…
dwc0011 8aefb0b
Add return if message is not nil
dwc0011 8d1c02d
Reword comment
dwc0011 e157faa
add mention of why encoding is an option and what the return value wi…
dwc0011 f89d727
Rename variables
dwc0011 b477cfa
Add comment
dwc0011 dc2ba3a
Update common/lib/dependabot/pull_request_creator/azure.rb
jeffwidman 08ec1bc
Update common/lib/dependabot/pull_request_creator/github.rb
jeffwidman cb325b8
Update common/lib/dependabot/pull_request_creator/codecommit.rb
jeffwidman 0225914
Update common/lib/dependabot/pull_request_creator/github.rb
jeffwidman 36e0687
Remove old variable that is now in pull_request_creator
dwc0011 0d82621
Update common/lib/dependabot/pull_request_creator/codecommit.rb
jeffwidman dbfd0bd
Update common/lib/dependabot/pull_request_creator/azure.rb
jeffwidman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,23 +168,6 @@ | |
end | ||
end | ||
|
||
context "with e very long pr description" do | ||
let(:pr_description) { ("a" * 3997) + "💣 kaboom" } | ||
it "truncates the description respecting azures encoding" do | ||
creator.create | ||
|
||
expect(WebMock). | ||
to( | ||
have_requested(:post, "#{repo_api_url}/pullrequests?api-version=5.0"). | ||
with do |req| | ||
description = JSON.parse(req.body).fetch("description") | ||
expect(description.length).to eq 4000 | ||
expect(description).to end_with("\n\n_Description has been truncated_") | ||
end | ||
) | ||
end | ||
end | ||
|
||
context "with author details provided" do | ||
let(:author_details) do | ||
{ email: "[email protected]", name: "dependabot" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Any reason why you picked
pr_message...
rather thanpr_description...
?My thinking is there are multiple messages tied to a PR, for example comments, reviews, etc but only one main description tied to it... Just checked and GitHub, AWS CodeCommit, BitBucket, GitLab, ADO all call it PR/MR Description, so appears that's relatively consistent terminology...
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.
I named it that as the method called is pr_message in MessageBuilder
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.
Ah, gotcha, yeah, it probably wouldn't hurt to rename that to DescriptionBuilder (totally out of scope of this PR)... I'll look into that after this is merged... let's leave this comment unresolved as a reminder to me.