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

[gerrit] Added support project's config file: .pr_agent.toml #287

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions pr_agent/git_providers/gerrit_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ def adopt_to_gerrit_message(message):
lines = message.splitlines()
buf = []
for line in lines:
line = line.replace("*", "").replace("``", "`")
# remove markdown formatting
line = (line.replace("*", "")
.replace("``", "`")
.replace("<details>", "")
.replace("</details>", "")
.replace("<summary>", "")
.replace("</summary>", ""))

line = line.strip()
if line.startswith('#'):
buf.append("\n" +
Expand Down Expand Up @@ -219,10 +226,12 @@ def get_commit_messages(self):
return [self.repo.head.commit.message]

def get_repo_settings(self):
"""
TODO: Implement support of .pr_agent.toml
"""
return ""
try:
with open(self.repo_path / ".pr_agent.toml", 'rb') as f:
contents = f.read()
return contents
except OSError:
return b""

def get_diff_files(self) -> list[FilePatchInfo]:
diffs = self.repo.head.commit.diff(
Expand Down
Loading