Skip to content

Commit 858363e

Browse files
refactor!: rewrite markdown-templates/step-feedback/step-results-table.md to Nunjucks syntax, remove required top-level passed argument (#70)
1 parent ebf43bb commit 858363e

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
{{#passed}}
1+
{%- set all_passed = (results_table | selectattr("passed") | length) == (results_table | length) %}
2+
3+
{%- if all_passed %}
24

35
## Step {{ step_number }} - Passed ✅
46

5-
{{/passed}}
6-
{{^passed}}
7+
{%- else %}
78

89
## Step {{ step_number }} - Fail ❌
910

10-
{{/passed}}
11+
{%- endif %}
1112

12-
{{#passed}}
13+
{%- if all_passed %}
1314
<img src="https://octodex.github.com/images/inflatocat.png" align="right" height="150px" alt="Inflatocat image indicating the step passed" />
14-
{{/passed}}
15-
{{^passed}}
15+
{%- else %}
16+
1617
<img src="https://octodex.github.com/images/spidertocat.png" align="right" height="100px" alt="Spidertocat image indicating the step failed" />
1718
Some checks failed. Please review the results below and try again.
1819

1920
Time to find the bug! 🤔
20-
{{/passed}}
21+
{%- endif %}
2122

2223
| Status | Description |
23-
| --- | --- |
24-
{{#results_table}}
25-
| {{#passed}}✅ - Pass{{/passed}}{{^passed}}❌ - Fail{{/passed}} | {{ description }} |
26-
{{/results_table}}
24+
| ------ | ----------- |
2725

28-
{{#tips.length}}
26+
{%- for row in results_table %}
27+
| {% if row.passed -%}✅ - Pass{%- else -%}❌ - Fail{%- endif %} | {{ row.description }} |
28+
{%- endfor %}
29+
30+
{%- if tips and tips.length %}
2931

3032
### Tips
3133

32-
{{#tips}}
34+
{%- for tip in tips %}
35+
36+
- {{ tip }}
37+
{%- endfor %}
3338

34-
- {{.}}
35-
{{/tips}}
36-
{{/tips.length}}
39+
{%- endif %}

0 commit comments

Comments
 (0)