Skip to content

Navigation Menu

Sign in
Sign up

GitLab CI CD

URLBug edited this page Mar 22, 2026 · 6 revisions

Using CodeFox with GitLab CI/CD

Example workflow

Choose one option:

Remote include

Best for quick setup.
variables:
 CODEFOX_BRANCH: "v1.0.0"
stages:
 - review
include:
 - remote: "https://raw.githubusercontent.com/codefox-lab/CodeFox-CLI/refs/tags/v0.4.5-alpha/codefox-template.yml"

Local include

Best for self-hosted or restricted environments.
variables:
 CODEFOX_BRANCH: "main"
stages:
 - review
include:
 - local: ".gitlab/codefox-template.yml"

Initial setup

First, in your project repository, run:

codefox init

This command will:

  • generate the required configuration files (.codefox.yml and .codefoxignore)
  • prepare the project for CodeFox analysis

Alternatively, you can manually add these files to your repository.


⚠️ Important

Do not commit the .codefoxenv file to your repository.

During initialization, the CLI will automatically and securely create .codefoxenv and store all required credentials inside it. This file is intended to remain local and must not be version-controlled.


Configure GitLab access

After adding .codefox.yml and .codefoxignore to your repository, you need to configure access for CodeFox.


1. Create a Personal Access Token

Go to:
Settings → Access Tokens

Click Add new token.

alt

alt

Fill in the following:

  • Name - any descriptive name (e.g. codefox)
  • Expiration date - optional
  • Role - Developer or Reporter
  • Scopes:
    • api
    • read_repository
    • write_repository

These permissions are required so CodeFox can:

  • read repository data for analysis
  • post comments to merge requests

After creating the token, copy it - you will not be able to see it again.


2. Add CI/CD variables

Go to:
Settings → CI/CD → Variables

Click Add variable.

alt

alt

Add the following variables:

  • GITLAB_TOKEN
    Value: your Personal Access Token created earlier
  • CODEFOX_API_KEY
    Value: your CodeFox API key

These variables are used to:

  • authenticate with GitLab
  • connect CodeFox to the AI service

alt


Result

After completing these steps, CodeFox will be able to:

  • access your repository
  • analyze merge requests
  • post review results directly into MR comments

CodeFox Wiki

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /