From 5742299a582cc4ac6f9994d4327ca3085302f710 Mon Sep 17 00:00:00 2001 From: Cintia Sanchez Garcia Date: Fri, 6 Sep 2024 12:56:24 +0200 Subject: [PATCH] Address some feedback Signed-off-by: Cintia Sanchez Garcia --- dco2/templates/{details.md => errors_details.md} | 0 dco2/templates/how_to_fix.md | 7 +++++++ dco2/templates/output.md | 10 ++-------- dco2/templates/summary.md | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) rename dco2/templates/{details.md => errors_details.md} (100%) create mode 100644 dco2/templates/how_to_fix.md diff --git a/dco2/templates/details.md b/dco2/templates/errors_details.md similarity index 100% rename from dco2/templates/details.md rename to dco2/templates/errors_details.md diff --git a/dco2/templates/how_to_fix.md b/dco2/templates/how_to_fix.md new file mode 100644 index 0000000..8cb6b88 --- /dev/null +++ b/dco2/templates/how_to_fix.md @@ -0,0 +1,7 @@ +{%~ if commits|contains_error([CommitError::SignOffNotFound, CommitError::SignOffMismatch]) +%} + ## How to fix missing or invalid sign-offs + + {%~ include "remediation.md" +%} + + {%~ include "signoff.md" +%} +{% endif %} diff --git a/dco2/templates/output.md b/dco2/templates/output.md index f3706e5..c8a30b8 100644 --- a/dco2/templates/output.md +++ b/dco2/templates/output.md @@ -18,15 +18,9 @@ {%~ include "summary.md" +%} - {%~ include "details.md" +%} + {%~ include "errors_details.md" +%} - {%~ if commits|contains_error([CommitError::SignOffNotFound, CommitError::SignOffMismatch]) +%} - {{~ "## How to fix missing or invalid sign-offs" +}} - - {%~ include "remediation.md" +%} - - {%~ include "signoff.md" +%} - {% endif %} + {%~ include "how_to_fix.md" +%} {% endif %} diff --git a/dco2/templates/summary.md b/dco2/templates/summary.md index 30f7185..2017bc6 100644 --- a/dco2/templates/summary.md +++ b/dco2/templates/summary.md @@ -7,9 +7,10 @@ {%+ for entry in commits %} {% let (sha_truncated, rest) = entry.commit.sha.split_at(8) %} {% let message = entry.commit.message.split_once('\n') %} + {% let subject = entry.commit.message.lines().next().unwrap_or_default() %} {% if entry.errors.is_empty() %} - | :green_circle: | [{{ sha_truncated }}]({{ entry.commit.html_url }}) | {% if let Some((subject, rest)) = message %}{{ subject|truncate(50) }}{% else %}{{ entry.commit.message|truncate(50) }}{% endif %} | {% if let Some(success_reason) = entry.success_reason %}`{{ success_reason|capitalize }}`{% endif %} | + | :green_circle: | [{{ sha_truncated }}]({{ entry.commit.html_url }}) | {{ subject|truncate(50) }} | {% if let Some(success_reason) = entry.success_reason %}`{{ success_reason|capitalize }}`{% endif %} | {% else %} - | :red_circle: | [{{ sha_truncated }}]({{ entry.commit.html_url }}) | {% if let Some((subject, rest)) = message %}{{ subject|truncate(50) }}{% else %}{{ entry.commit.message|truncate(50) }}{% endif %} |{% for error in entry.errors %}{% if !loop.first %}{{ " " +}}{% endif %}`{{ error|capitalize }}`{% endfor %} | + | :red_circle: | [{{ sha_truncated }}]({{ entry.commit.html_url }}) | {{ subject|truncate(50) }} |{% for error in entry.errors %}{% if !loop.first %}{{ " " +}}{% endif %}`{{ error|capitalize }}`{% endfor %} | {% endif +%} {%+ endfor +%}