From 8ef44ccb20bd35100e3847b9196461acf4ed0874 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Tue, 24 Jun 2025 13:30:28 +0000 Subject: [PATCH 1/7] refactor: modify templates to use nunjucks templating --- .../readme/exercise-finished.md | 2 +- markdown-templates/readme/exercise-started.md | 2 +- .../step-feedback/step-results-table.md | 33 +++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/markdown-templates/readme/exercise-finished.md b/markdown-templates/readme/exercise-finished.md index a760fe4..9713dc5 100644 --- a/markdown-templates/readme/exercise-finished.md +++ b/markdown-templates/readme/exercise-finished.md @@ -24,7 +24,7 @@ ### 🎯 What's Next? **Keep the momentum going!** -[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{{ issue_url }}}) +[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url | safe }}) [![GitHub Skills](https://img.shields.io/badge/Explore%20GitHub%20Skills-000000?style=for-the-badge&logo=github&logoColor=white)](https://skills.github.com) *There's no better way to learn than building things!* 🚀 diff --git a/markdown-templates/readme/exercise-started.md b/markdown-templates/readme/exercise-started.md index 1343052..b53d94d 100644 --- a/markdown-templates/readme/exercise-started.md +++ b/markdown-templates/readme/exercise-started.md @@ -8,7 +8,7 @@ Mona here. I'm done preparing your exercise. Hope you enjoy! 💚 Remember, it's self-paced so feel free to take a break! ☕️ -[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{{ issue_url }}}) +[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url | safe }}) --- diff --git a/markdown-templates/step-feedback/step-results-table.md b/markdown-templates/step-feedback/step-results-table.md index 876bd8a..a21c1e0 100644 --- a/markdown-templates/step-feedback/step-results-table.md +++ b/markdown-templates/step-feedback/step-results-table.md @@ -1,36 +1,35 @@ -{{#passed}} +{% if passed %} ## Step {{ step_number }} - Passed ✅ -{{/passed}} -{{^passed}} +{% else %} ## Step {{ step_number }} - Fail ❌ -{{/passed}} +{% endif %} -{{#passed}} +{% if passed %} Inflatocat image indicating the step passed -{{/passed}} -{{^passed}} +{% else %} Spidertocat image indicating the step failed Some checks failed. Please review the results below and try again. Time to find the bug! 🤔 -{{/passed}} +{% endif %} | Status | Description | -| --- | --- | -{{#results_table}} -| {{#passed}}✅ - Pass{{/passed}}{{^passed}}❌ - Fail{{/passed}} | {{ description }} | -{{/results_table}} +| ------ | ----------- | -{{#tips.length}} +{% for row in results_table %} +| {% if row.passed %}✅ - Pass{% else %}❌ - Fail{% endif %} | {{ row.description }} | +{% endfor %} + +{% if tips and tips.length %} ### Tips -{{#tips}} +{% for tip in tips %} -- {{.}} - {{/tips}} - {{/tips.length}} +- {{ tip }} +{% endfor %} +{% endif %} From 836c449209e6bb14a924f806a9ccea49458cdbae Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:47:36 +0000 Subject: [PATCH 2/7] Work on whitespacing in nunjucks --- .../step-feedback/step-results-table.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/markdown-templates/step-feedback/step-results-table.md b/markdown-templates/step-feedback/step-results-table.md index a21c1e0..1e4c022 100644 --- a/markdown-templates/step-feedback/step-results-table.md +++ b/markdown-templates/step-feedback/step-results-table.md @@ -1,35 +1,36 @@ -{% if passed %} +{%- if passed %} ## Step {{ step_number }} - Passed ✅ -{% else %} +{%- else %} ## Step {{ step_number }} - Fail ❌ -{% endif %} +{%- endif %} -{% if passed %} +{%- if passed %} Inflatocat image indicating the step passed -{% else %} +{%- else %} Spidertocat image indicating the step failed Some checks failed. Please review the results below and try again. Time to find the bug! 🤔 -{% endif %} +{%- endif %} | Status | Description | | ------ | ----------- | -{% for row in results_table %} -| {% if row.passed %}✅ - Pass{% else %}❌ - Fail{% endif %} | {{ row.description }} | -{% endfor %} +{%- for row in results_table %} +| {% if row.passed -%}✅ - Pass{%- else -%}❌ - Fail{%- endif %} | {{ row.description }} | +{%- endfor %} -{% if tips and tips.length %} +{%- if tips and tips.length %} ### Tips -{% for tip in tips %} +{%- for tip in tips %} - {{ tip }} -{% endfor %} -{% endif %} + {%- endfor %} + +{%- endif %} From dab9d99926dedb86df3a065730aa0f75d223aefc Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:51:20 +0000 Subject: [PATCH 3/7] Update finish exercise ref --- .github/workflows/finish-exercise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/finish-exercise.yml b/.github/workflows/finish-exercise.yml index 7019b67..c005de9 100644 --- a/.github/workflows/finish-exercise.yml +++ b/.github/workflows/finish-exercise.yml @@ -22,7 +22,7 @@ permissions: issues: write env: - EXERCISE_TOOLKIT_REF: 85962a50afd57183f6703c3d07260bf3a123b3e9 + EXERCISE_TOOLKIT_REF: 836c449209e6bb14a924f806a9ccea49458cdbae jobs: update_readme: From e67d0a6b0c743aee86ea69d0726f311123e2f536 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 26 Jun 2025 11:44:47 +0000 Subject: [PATCH 4/7] fix: update step-results-table to calculate all_passed based rows --- markdown-templates/step-feedback/step-results-table.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/markdown-templates/step-feedback/step-results-table.md b/markdown-templates/step-feedback/step-results-table.md index 1e4c022..60fd97e 100644 --- a/markdown-templates/step-feedback/step-results-table.md +++ b/markdown-templates/step-feedback/step-results-table.md @@ -1,4 +1,6 @@ -{%- if passed %} +{%- set all_passed = (results_table | selectattr("passed") | length) == (results_table | length) %} + +{%- if all_passed %} ## Step {{ step_number }} - Passed ✅ @@ -8,7 +10,7 @@ {%- endif %} -{%- if passed %} +{%- if all_passed %} Inflatocat image indicating the step passed {%- else %} Spidertocat image indicating the step failed From 95f4650029132d754caa027fe1eb95cccf838648 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:09:48 +0000 Subject: [PATCH 5/7] Revert unnecessary changed files --- markdown-templates/readme/exercise-finished.md | 2 +- markdown-templates/readme/exercise-started.md | 2 +- markdown-templates/step-feedback/step-results-table.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/markdown-templates/readme/exercise-finished.md b/markdown-templates/readme/exercise-finished.md index 9713dc5..a910978 100644 --- a/markdown-templates/readme/exercise-finished.md +++ b/markdown-templates/readme/exercise-finished.md @@ -24,7 +24,7 @@ ### 🎯 What's Next? **Keep the momentum going!** -[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url | safe }}) +[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url}}) [![GitHub Skills](https://img.shields.io/badge/Explore%20GitHub%20Skills-000000?style=for-the-badge&logo=github&logoColor=white)](https://skills.github.com) *There's no better way to learn than building things!* 🚀 diff --git a/markdown-templates/readme/exercise-started.md b/markdown-templates/readme/exercise-started.md index b53d94d..eab5abf 100644 --- a/markdown-templates/readme/exercise-started.md +++ b/markdown-templates/readme/exercise-started.md @@ -8,7 +8,7 @@ Mona here. I'm done preparing your exercise. Hope you enjoy! 💚 Remember, it's self-paced so feel free to take a break! ☕️ -[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url | safe }}) +[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url }}) --- diff --git a/markdown-templates/step-feedback/step-results-table.md b/markdown-templates/step-feedback/step-results-table.md index 60fd97e..b193e84 100644 --- a/markdown-templates/step-feedback/step-results-table.md +++ b/markdown-templates/step-feedback/step-results-table.md @@ -13,6 +13,7 @@ {%- if all_passed %} Inflatocat image indicating the step passed {%- else %} + Spidertocat image indicating the step failed Some checks failed. Please review the results below and try again. From bbd97d56a9dffc41f919187dc3544894a1ae92e0 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:10:45 +0000 Subject: [PATCH 6/7] Revert unnecessary changed files --- markdown-templates/readme/exercise-finished.md | 2 +- markdown-templates/readme/exercise-started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/markdown-templates/readme/exercise-finished.md b/markdown-templates/readme/exercise-finished.md index a910978..a760fe4 100644 --- a/markdown-templates/readme/exercise-finished.md +++ b/markdown-templates/readme/exercise-finished.md @@ -24,7 +24,7 @@ ### 🎯 What's Next? **Keep the momentum going!** -[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url}}) +[![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{{ issue_url }}}) [![GitHub Skills](https://img.shields.io/badge/Explore%20GitHub%20Skills-000000?style=for-the-badge&logo=github&logoColor=white)](https://skills.github.com) *There's no better way to learn than building things!* 🚀 diff --git a/markdown-templates/readme/exercise-started.md b/markdown-templates/readme/exercise-started.md index eab5abf..1343052 100644 --- a/markdown-templates/readme/exercise-started.md +++ b/markdown-templates/readme/exercise-started.md @@ -8,7 +8,7 @@ Mona here. I'm done preparing your exercise. Hope you enjoy! 💚 Remember, it's self-paced so feel free to take a break! ☕️ -[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{ issue_url }}) +[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{{ issue_url }}}) --- From 6fdf693c7a6d5e7fee4b15018a1fa899155c8f91 Mon Sep 17 00:00:00 2001 From: Aleksander Fidelus <63016446+FidelusAleksander@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:11:32 +0000 Subject: [PATCH 7/7] Revert unnecessary changed files --- .github/workflows/finish-exercise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/finish-exercise.yml b/.github/workflows/finish-exercise.yml index c005de9..7019b67 100644 --- a/.github/workflows/finish-exercise.yml +++ b/.github/workflows/finish-exercise.yml @@ -22,7 +22,7 @@ permissions: issues: write env: - EXERCISE_TOOLKIT_REF: 836c449209e6bb14a924f806a9ccea49458cdbae + EXERCISE_TOOLKIT_REF: 85962a50afd57183f6703c3d07260bf3a123b3e9 jobs: update_readme: