--- title: Install MegaLinter on Gitlab CI description: Manual instructions to setup MegaLinter as a Gitlab Pipeline job --- # GitLab CI Create or update `.gitlab-ci.yml` file at the root of your repository ```yaml # MegaLinter GitLab CI job configuration file # More info at https://megalinter.io/ mega-linter: stage: test # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ image: oxsecurity/megalinter:v9 script: [ "true" ] # if script: ["true"] doesn't work, you may try -> script: [ "/bin/bash /entrypoint.sh" ] variables: # All available variables are described in documentation # https://megalinter.io/configuration/ DEFAULT_WORKSPACE: $CI_PROJECT_DIR # ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY artifacts: when: always paths: - megalinter-reports expire_in: 1 week ``` Create a Gitlab access token and define it in a variable **GITLAB_ACCESS_TOKEN_MEGALINTER** in the project CI/CD masked variables. Make sure your token (e.g. if a project token) as the appropriate [role](https://docs.gitlab.com/ee/user/permissions.html) for commenting a merge request (at least developer). ![config-gitlab-access-token](https://user-images.githubusercontent.com/17500430/151674446-1bcb1420-d9aa-4ae1-aaae-dcf51afb36ab.gif) ![Screenshot](https://github.com/oxsecurity/megalinter/blob/main/docs/assets/images/TextReporter_gitlab_1.jpg?raw=true)