Skip to content

CI/CD Integration

Using GitHub Actions to Annotate PRs

There are two way to utilize SQLFluff to annotate Github PRs.

  1. When sqlfluff lint is run with the --format github-annotation-native option, it produces output formatted as Github workflow commands which are converted into pull request annotations by Github.

  2. When sqlfluff lint is run with the --format github-annotation option, it produces output compatible with this action from yuzutech. Which uses Github API to annotate the SQL in GitHub pull requests.

WARNING

GitHub currently limits the number of annotations displayed per workflow run when using github-annotation-native. If you have many violations you may find only the first 10 are shown. This is not something SQLFluff can control; we recommend using the second option above and the action from yuzutech if you need full annotation coverage. Track the GitHub Actions feature request for updates on this limitation.

For more information and examples on using SQLFluff in GitHub Actions, see the sqlfluff-github-actions repository.

Using GitLab CI Code Quality reports

When sqlfluff lint is run with the --format gitlab option, it produces a GitLab Code Quality report (the Code Climate issue format). GitLab can ingest that file and show findings in merge requests.

A typical job writes the report with --write-output and publishes it as a codequality artifact:

yaml
lint-sql:
  image: sqlfluff/sqlfluff
  script:
    - sqlfluff lint --format gitlab --write-output gl-code-quality-report.json
  artifacts:
    reports:
      codequality: gl-code-quality-report.json

Released under the MIT License.