Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.04 KiB
Newer Older
# -*- coding: utf-8 -*-
# vim: ft=yaml
---

###############################################################################
# Define stages and global variables
###############################################################################
default:
  tags:
    - one
    - eole
    - docker

stages:
  - lint
variables:
  DOCKER_DRIVER: 'overlay2'

commitlint:
  stage: lint
  image: 'hub.eole.education/eole/commitlint:latest'
  before_script:
    # Add `upstream` remote to get access to `upstream/master`
    - "git remote show upstream 2> /dev/null || git remote add upstream ${CI_REPOSITORY_URL}"
    - 'git fetch --all'
  after_script:
    # Remove `upstream` to avoid caching `CI_JOB_TOKEN`
    - "git remote remove upstream"
  script:
    # Set default commit hashes for `--from` and `--to`
    - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
    - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
    # Run `commitlint`
    - 'commitlint --from "${COMMITLINT_FROM}"
                  --to   "${COMMITLINT_TO}"
                  --verbose'