Warning: This Hook has been updated and tested for Gitlab 16.x. There is no gurantee it works for earlier versions (Link).
pre-commit-hook validating and linting your .gitlab.ci.yml
using the /ci/lint/
API endpoint.
- includes merged or imported gitlab-ci configurations
- automatically detect Gitlab Server & Project Path by using
git remote
- specify custom gitlab-ci.yml
jq
curl
you will need to export
GITLAB_TOKEN
with scopeapi
, otherwise you will receive401 Unauthorized
:
# ## token with api scope
export GITLAB_TOKEN="abc123"
Add to your
pre-commit-config.yaml
:
repos:
- repo: https://github.com/FalcoSuessgott/lint-gitlab-ci
rev: v0.0.6
hooks:
- id: gitlab-ci
repos:
- repo: https://github.com/FalcoSuessgott/lint-gitlab-ci
rev: v0.0.6
hooks:
- id: gitlab-ci
args: [ ".custom-ci-file.yml" ]