From d8a9060bac7d0e4b0003ba69e4395c2209f8e98a Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 28 Jul 2023 14:13:41 +0200 Subject: [PATCH] [nrf noup] ci: NCS-specific CI tweaks fixup! [nrf noup] ci: NCS-specific CI tweaks - Now that gitlint supports --commits with a single commit natively, remove the extra logic: https://github.com/jorisroovers/gitlint/pull/412 - Fix gitlint ncs extension matching logic: the group was wrong (group 1 is the Revert, group 2 is the actual sauce tag). Signed-off-by: Carles Cufi --- .github/workflows/compliance.yml | 6 ++---- scripts/gitlint/ncs.py | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index a41ab9a4719..002179b6740 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -41,11 +41,9 @@ jobs: #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ #(echo "::error ::Merge commits not allowed, rebase instead";false) # Sauce tag checks before rebasing - # Handle single commit separately - if [[ "$(git rev-list --first-parent --count origin/${BASE_REF}..HEAD)" == "1" ]]; then COMMITS="--commit"; else COMMITS="--commits"; fi - git rev-list --first-parent origin/${BASE_REF}..HEAD | paste -sd, | \ + git rev-list --first-parent origin/${BASE_REF}..HEAD | tr '\n' ',' | \ xargs gitlint -c ncs-sauce-tags.enable=true \ - -c title-starts-with-subsystem.regex=".*" $COMMITS + -c title-starts-with-subsystem.regex=".*" --commits git rebase origin/${BASE_REF} # debug git log --pretty=oneline | head -n 10 diff --git a/scripts/gitlint/ncs.py b/scripts/gitlint/ncs.py index a70ce4c900c..3ec805550c2 100644 --- a/scripts/gitlint/ncs.py +++ b/scripts/gitlint/ncs.py @@ -31,7 +31,11 @@ def validate(self, commit): return [RuleViolation(self.id, 'Title does not contain a sauce tag', line_nr=1)] - tag = m.group(1) + tag = m.group(2) + + if not tag: + return [RuleViolation(self.id, 'Title does not contain a sauce tag', + line_nr=1)] self.log.debug(f'Matched sauce tag {tag}') if tag == 'mergeup':