Skip to content

Commit

Permalink
[nrf noup] ci: NCS-specific CI tweaks
Browse files Browse the repository at this point in the history
fixup! [nrf noup] ci: NCS-specific CI tweaks

- Now that gitlint supports --commits with a single commit natively,
remove the extra logic: jorisroovers/gitlint#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 <carles.cufi@nordicsemi.no>
  • Loading branch information
carlescufi committed Jul 28, 2023
1 parent f8818ca commit d8a9060
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion scripts/gitlint/ncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit d8a9060

Please sign in to comment.