feature: option to remove separator as part of cutting body
jbergstroem opened this issue · comments
When using cut body before or after, there should be an option to include removing the separator from said result.
At my company we take parts of the PR body, validate it with commitlint
and if ok, tell kodiak to use it for body. We use the markdown hr separator to split what we want in the commit body and what we can keep in the PR body (---
). Right now, if I use cut_body_after
, it keeps the separator:
Original body
Here's a body
---
And here's the footer
Expected output
Here's a body
Actual output
Here's a body
---
I would like to suggest an option that toggles the removal of the separator as part of cutting the body.
Also, perhaps something that removes extra newlines (1 empty newline between title, body and footer seems to be the norm)?
This seems like a simple change to make.
We'd need to add a new configuration option and then update this code:
kodiak/bot/kodiak/evaluation.py
Lines 81 to 88 in 852e345
I'm not sure what the new configuration option should be called. Maybe merge.message.cut_body_and_text
I'm not sure what the new configuration option should be called. Maybe merge.message.cut_body_and_text
I have a PR almost done, used the name strip_separator: (True|False)
. I chose to not refactor the code (I think we can redo how its calculated), lmk what you think in a bit - happy to change name.
Edit: renamed per your suggestion.
FYI, ran into issues updating the config schema:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/opt/python@3.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/jbergstroem/wrk/oss/kodiak/bot/kodiak/cli.py", line 9, in <module>
from kodiak import app_config as conf
File "/Users/jbergstroem/wrk/oss/kodiak/bot/kodiak/app_config.py", line 39, in <module>
"REDISCLOUD_URL", cast=databases.DatabaseURL
File "/Users/jbergstroem/wrk/oss/kodiak/bot/kodiak/app_config.py", line 32, in __call__
return super().get(key, cast=cast, default=default) # type: ignore [arg-type]
File "/Users/jbergstroem/wrk/oss/kodiak/bot/.venv/lib/python3.7/site-packages/starlette/config.py", line 72, in get
raise KeyError(f"Config '{key}' is missing, and has no default.")
KeyError: "Config 'REDISCLOUD_URL' is missing, and has no default."
I think you need to cp example.env .env
to get the default env vars to work
I think you need to
cp example.env .env
to get the default env vars to work
Ah, right. Will give it a go.
In case anyone else runs into this:
- copy
example.env
to.env
- create an empty file –
your-app-name.some-date.private-key.pem
– expected to exist viaGITHUB_PRIVATE_KEY_PATH
- (re)generate the schema as normal