Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cd260df authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

ci: add a job to check commit message

parent aaaffdd0
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -19,6 +19,27 @@ lint:dockerfile:
  script:
    - for file in Dockerfile Dockerfile.jekyll Dockerfile.nginx; do echo "Linting $file"; hadolint "$file"; done

lint:commit_message:
  stage: lint
  image: node:18
  before_script:
    - npm install --location=global @commitlint/cli @commitlint/config-conventional
    - |
      cat > commitlint.config.js <<'JS'
      module.exports = {
        extends: ['@commitlint/config-conventional']
      };
      JS
    - git fetch --unshallow || true
    - git fetch origin $CI_DEFAULT_BRANCH
  script:
    - |
      COMMITS=$(git rev-list origin/$CI_DEFAULT_BRANCH..HEAD)
      echo "$COMMITS" | while read commit; do
        echo "Linting commit $commit"
        git show --no-patch --format=%B $commit | commitlint || exit 1
      done

# Build stage
.build:docker:
  stage: build