Skip to content

FalcoSuessgott/lint-gitlab-ci

Repository files navigation

pre-commit-hook: lint-gitlab-ci

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.

shellcheck

Features

  • includes merged or imported gitlab-ci configurations
  • automatically detect Gitlab Server & Project Path by using git remote
  • specify custom gitlab-ci.yml

Dependencies

  • jq
  • curl

Prerequisites

you will need to export GITLAB_TOKEN with scope api, otherwise you will receive 401 Unauthorized:

# ## token with api scope
export GITLAB_TOKEN="abc123"

Usage

Add to your pre-commit-config.yaml:

repos:
  - repo: https://github.com/FalcoSuessgott/lint-gitlab-ci
    rev: v0.0.6
    hooks:
      - id: gitlab-ci

Configuration

repos:
  - repo: https://github.com/FalcoSuessgott/lint-gitlab-ci
    rev: v0.0.6
    hooks:
      - id: gitlab-ci
        args: [ ".custom-ci-file.yml" ]

About

pre-commit hook that vaildates gitlab-ci.yml

Resources

Stars

Watchers

Forks

Packages

No packages published