diff --git a/docs/DESCRIBE.md b/docs/DESCRIBE.md index 05d1608a..3db21a13 100644 --- a/docs/DESCRIBE.md +++ b/docs/DESCRIBE.md @@ -27,18 +27,14 @@ Under the section 'pr_description', the [configuration file](./../pr_agent/setti - `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". -#### Markers template +### Markers template markers enable to easily integrate user's content and auto-generated content, with a template-like mechanism. -- `use_description_markers`: if set to true, the tool will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false. - For example, if the PR original description was: ``` User content... -## PR Type: -pr_agent:pr_type ## PR Description: pr_agent:summary @@ -46,6 +42,21 @@ pr_agent:summary ## PR Walkthrough: pr_agent:walkthrough ``` -The marker `pr_agent:pr_type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, and `pr_agent:walkthrough` will be replaced with the PR walkthrough. +The marker `pr_agent:summary` will be replaced with the PR summary, and `pr_agent:walkthrough` will be replaced with the PR walkthrough. +##### Example: +``` + env: + pr_description.use_description_markers: 'true' +``` + + + +==> + + + +##### Configuration params: + +- `use_description_markers`: if set to true, the tool will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false. - `include_generated_by_header`: if set to true, the tool will add a dedicated header: 'Generated by PR Agent at ...' to any automatic content. Default is true. diff --git a/pics/describe_markers_after.png b/pics/describe_markers_after.png new file mode 100644 index 00000000..933cf924 Binary files /dev/null and b/pics/describe_markers_after.png differ diff --git a/pics/describe_markers_before.png b/pics/describe_markers_before.png new file mode 100644 index 00000000..2c86653a Binary files /dev/null and b/pics/describe_markers_before.png differ diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 1561f53c..c1bd03fd 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -186,6 +186,11 @@ class PRDescription: else: ai_header = "" + ai_type = self.data.get('PR Type') + if ai_type and not re.search(r'', body): + pr_type = f"{ai_header}{ai_type}" + body = body.replace('pr_agent:type', pr_type) + ai_summary = self.data.get('PR Description') if ai_summary and not re.search(r'', body): summary = f"{ai_header}{ai_summary}"