From d2c87951a42d1737d35c506623ff00669ec40015 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Mon, 11 Nov 2024 13:44:03 +0100 Subject: [PATCH] doc: add gitlabci example --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 7011988..4bbc90c 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,25 @@ rules: - always - [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] ``` + +### Example GitLab CI Job + +```yaml +commitlint: + stage: .pre # Default Stage of gitlab-ci. Runs before every other pipeline + image: + name: ghcr.io/voxpupuli/commitlint:latest + entrypoint: [""] # overwrite entrypoint + interruptible: true + variables: + # Checkout entire repo and use clone + GIT_DEPTH: 0 + GIT_STRATEGY: clone + script: + # switch to MR branch instead of detached HEAD + - git switch $CI_COMMIT_REF_NAME + - commitlint --from $(git merge-base origin/$CI_DEFAULT_BRANCH HEAD) --to HEAD + rules: + # only run on merge request pipelines + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' +```