-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
strip content from pull request body on merge #550
Comments
@stefanbuck would it be possible to sorround the generated badges with some "marker" markup, so tools like kodiak could strip it? or maybe even pullrequestbadge itself could strip the markup again before the PR gets merged? |
I think if the content was wrapped with HTML with a specific
# .kodiak.toml
[merge.message]
strip_html_ids = ["pull-request-badge"] # remove HTML nodes with `id`
We could also maybe do something with comments and remove content between specific comments.
# .kodiak.toml
[merge.message]
strip_html_comment_spans = ["pull-request-badge"] I think the challenge is finding syntax that looks okay if it's not removed. |
Possible, but that way you remove badges from merged PRs. Personally I find it quite useful when looking at an older PR (particular the JIRA badge). However, there is already a separator comment: |
I think to be safe, it would be better if there are comments before and after the PR Badge content. So I think a generic solution would look something like:
and then Kodiak would delete any content inside comments that begin with a prefix like I think the config @chdsbd outlined would work with this comment setup: # .kodiak.toml
[merge.message]
strip_html_comment_spans = ["PR-BADGE"] |
I see your point, but this is not possible. Pull Request Badge runs whenever the description is added or updated. That way badges are always on top. If you still have strong feeling I'm happy to add such an opening comment |
Gotcha, I think if there is an opening comment as well, then this feature can be used with any tool that adds stuff to a PR body. With only the closing comment we'd have to do a one-off for PR Badge which is doable, but it would be nice if we added something more general for other bots |
I would be interested in a similar feature, but I would like to suggest a different configuration approach. At my work, we used bors in the past but switched to Kodiak, as it's more flexible. Bors has a configuration named
We found this config very useful, and would like a similar feature for Kodiak. What would you think if we had: # .kodiak.toml
[merge.message]
cut_body_before = "kodiak-message:start"
cut_body_after = "kodiak-message:end" The marker could even be an html comment so it's not seen in the PR description: # .kodiak.toml
[merge.message]
cut_body_before = "<!-- kodiak-message:start -->"
cut_body_after = "<!-- kodiak-message:end -->" This way we would be in full control of the commit message and that should cover your use case @clxmstaab ? What do you think? |
@ardeois's suggestion seems like it would work. # .kodiak.toml
[merge.message]
cut_body_before = "<!-- PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT -->" I think we'd need to add a couple config options to: Lines 33 to 45 in 59d155d
And update this function to use those new config options: kodiak/bot/kodiak/evaluation.py Lines 65 to 77 in 59d155d
|
@chdsbd please let me know if you still need the opening comment. I just had no time to do it, but should be easy. |
@stefanbuck I think we're all set know thanks to @ardeois's suggestion. With the "cut_body_before" option we can remove the badges by specifying the PR-Badge comment. |
As I understood it, the solution of @ardeois will work for us, in case @stefanbuck will add the necessary markup |
So to remove the PR Badge labels from a message like:
We can use the following config: # .kodiak.toml
[merge.message]
body = "pull_request_body"
cut_body_before = "<!-- PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT -->"
strip_html_comments = true And on merge we'll have the following commit message:
The Please open an issue if you run into any problems. |
just stumbled upon another use-case. when merging dependabot-PRs using kodiak we get a long list of useless stuff at the end of the merge-commit. example: we will use |
we are using https://pullrequestbadge.com/ which adds pull request badges into our PR descriptions based on keywords in the PR title (e.g. a JIRA Issue key)
example how this looks like:
the badges get inserted by a github marketplace app automatically.
since we use the PR-body as a commit message, commits contains this ugly markdown:
we would love to sorround the generated markup with e.g. a html comment, so kodiak could strip it when merging.
what do you think?
we have the following kodiak config regarding merge.
The text was updated successfully, but these errors were encountered: