renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.13k stars 2.22k forks source link

PR body: use html delimiters to allow appending or prepending to content #28933

Open rarkins opened 4 months ago

rarkins commented 4 months ago

Describe the proposed change(s).

We should start adding <!--renovate-pr-body-start--> before our content and <!--renovate-pr-body-end--> after it, and ignoring any content before or after that. If either tag is missing then we assume that the start or end of the content is the start or end of the PR body itself.

We should not proactively edit every existing PR and cause a lot of edits, but if we are already editing an existing PR then we should add these delimiters. If editing a PR then we should retain any content before or after.

For platforms which don't support hidden html comments, we should strip this content out, which means we don't support PR body editing on those platforms.

HonkingGoose commented 2 weeks ago

Accept one-time "bad" thing for simplicity

We should not proactively edit every existing PR and cause a lot of edits, but if we are already editing an existing PR then we should add these delimiters. If editing a PR then we should retain any content before or after.

This is your judgment call of course, but I think it's okay for Renovate to update all the PRs at once. If we accept that one-time "bad thing", we get:

Options

I think we have these options:

Always add delimiters

This seems easy:

  1. Write tests for the add delimiter feature
  2. Write code to add delimiters

Conditional add delimiters

This seems hard:

  1. Write tests for the happy path for the delimiter feature
  2. Write code to add delimiters
  3. Write tests for the difficult paths, where Renovate should skip adding delimiters
  4. Write code for the difficult paths
  5. Write code to allow updating open PRs, when Renovate is "touching" the PR for some other reason

Something else?

I don't know if there are better options than the things listed above. :smile: