Skip to content

EkLine GitLab Integration

Automate documentation review in GitLab Merge Requests using the EkLine CI/CD pipeline.

  • EkLine Integration Token: Retrieve this from the EkLine Dashboard > View Integration Token.
  • GitLab Project: Admin access to configure CI/CD variables.

To enable EkLine, create, or update the .gitlab-ci.yml file in your project root with the following configuration.

stages:
- ekline-pr-review
ekline-pr-review-job:
stage: ekline-pr-review
image: ghcr.io/ekline-io/ekline-ci-cd:v6
interruptible: true
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- echo "Running EkLine"
variables:
INPUT_EK_TOKEN: $EK_TOKEN
INPUT_GITLAB_TOKEN: $GITLAB_API_TOKEN
INPUT_CONTENT_DIR: '<path_to_content_directory>'
INPUT_REPORTER: 'gitlab-mr-discussion'
INPUT_FILTER_MODE: 'added'
# INPUT_IGNORE_RULE: "EK00001,EK00004" # Optional
# INPUT_EXCLUDE_DIRECTORIES: "docs/archive,legacy_content" # Optional: Comma-separated list
# INPUT_EXCLUDE_FILES: "README.md,CHANGELOG.md" # Optional: Comma-separated list
# INPUT_STYLE_GUIDE: "https://example.com/my-style-guide.json" # Optional: URL or path

Replace <path_to_content_directory> with the actual path to your content directory.

The configuration above includes interruptible: true on the review job. This setting automatically cancels a running EkLine review when you push a new commit to the same merge request. Without it, multiple review jobs can run in parallel on the same merge request, which wastes CI/CD minutes and can produce duplicate or outdated review comments.

Tip: Combine interruptible: true with the GitLab project setting Auto-cancel redundant pipelines (under Settings > CI/CD > General pipelines) to ensure only the latest pipeline runs for each merge request.

  1. In GitLab, go to Settings > Access tokens.
  2. Create a token with API access.
  3. Add the token to your project’s CI/CD > Variables as GITLAB_API_TOKEN.
  1. Obtain your integration token by visiting the EkLine dashboard and clicking on the View Integration Token button.
  2. Add the token to your project’s CI/CD > Variables as EK_TOKEN.

You can choose between two options for INPUT_REPORTER:

  • gitlab-mr-discussion (default): Reports results as merge request discussions.
  • gitlab-mr-commit: Reports results to each commit in GitLab MergeRequest.

The following options are available for INPUT_FILTER_MODE:

  • added default: Filter results by added or modified lines.
  • diff_context: Filter results by diff context. That’s changed lines +-N lines, such as N=3.
  • file: Filter results by added or modified file. EkLine reports results if they’re in added or modified files even if the results aren’t in the actual diff.
  • nofilter: Don’t filter any results. Useful for posting results as comments as much as possible and check other results in the console at the same time.

To ignore specific rules during the review process, you can use the INPUT_IGNORE_RULE flag. This flag accepts a comma-separated list of rule identifiers that you wish to skip.

For example, to ignore rules EK00001 and EK00004, you can set the INPUT_IGNORE_RULE flag in your configuration like this:

INPUT_IGNORE_RULE: "EK00001,EK00004"

Exclude specific content directories and files

Section titled “Exclude specific content directories and files”
  • Exclude specific directories from review.
  • Exclude specific files from review.
  • Specify a custom style guide to apply during content analysis.

Exclude directories and files, and specify a style guide:

variables:
INPUT_CONTENT_DIR: 'docs'
INPUT_EXCLUDE_DIRECTORIES: "docs/archive,docs/drafts"
INPUT_EXCLUDE_FILES: "README.md,docs/legacy.md"
INPUT_STYLE_GUIDE: "https://example.com/custom-style-guide.json"

Just exclude files:

variables:
INPUT_EXCLUDE_FILES: "README.md,CONTRIBUTING.md"

Specify a style guide only:

variables:
INPUT_STYLE_GUIDE: ".ekline/style-guide.json"

Once you have configured the options, save your changes and push the .gitlab-ci.yml file to your repository. Now, EkLine runs on your content directory and gives feedback as merge request discussions tailored to your custom settings.