File tree Expand file tree Collapse file tree 4 files changed +6
-2
lines changed Expand file tree Collapse file tree 4 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ def generate_comment(
133
133
previous_coverage_rate = previous_coverage ,
134
134
base_template = template .read_template_file ("comment.md.j2" ),
135
135
custom_template = config .COMMENT_TEMPLATE ,
136
+ subproject_id = config .SUBPROJECT_ID ,
136
137
marker = template .get_marker (marker_id = config .SUBPROJECT_ID ),
137
138
)
138
139
except template .MissingMarker :
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ def get_comment_markdown(
51
51
previous_coverage_rate : decimal .Decimal | None ,
52
52
base_template : str ,
53
53
marker : str ,
54
+ subproject_id : str | None = None ,
54
55
custom_template : str | None = None ,
55
56
):
56
57
loader = CommentLoader (base_template = base_template , custom_template = custom_template )
@@ -62,6 +63,7 @@ def get_comment_markdown(
62
63
previous_coverage_rate = previous_coverage_rate ,
63
64
coverage = coverage ,
64
65
diff_coverage = diff_coverage ,
66
+ subproject_id = subproject_id ,
65
67
marker = marker ,
66
68
)
67
69
except jinja2 .exceptions .TemplateError as exc :
Original file line number Diff line number Diff line change 1
- {% block title %} ## Coverage report{% endblock title %}
1
+ {% block title %} ## Coverage report{% if subproject_id %} ({{ subproject_id }}) {% endif %}{% endblock title %}
2
2
{% block coverage_evolution -%}
3
3
{% if previous_coverage_rate -%}
4
4
{% block coverage_evolution_wording -%}
Original file line number Diff line number Diff line change @@ -47,11 +47,12 @@ def test_template(coverage_obj, diff_coverage_obj):
47
47
previous_coverage_rate = decimal .Decimal ("0.92" ),
48
48
base_template = template .read_template_file ("comment.md.j2" ),
49
49
marker = "<!-- foo -->" ,
50
+ subproject_id = "foo" ,
50
51
custom_template = """{% extends "base" %}
51
52
{% block emoji_coverage_down %}:sob:{% endblock emoji_coverage_down %}
52
53
""" ,
53
54
)
54
- expected = """## Coverage report
55
+ expected = """## Coverage report (foo)
55
56
The coverage rate went from `92%` to `75%` :sob:
56
57
The branch rate is `50%`.
57
58
You can’t perform that action at this time.
0 commit comments