Running clj-kondo with Github Actions
03 Apr 2020clj-kondo
is a linter that sparks joy. This has definitely resonated with me.
It’s great for running locally as well as in CI environment.
There are several options from the Github Marketplace. You can also easily set this up yourself. You do not need an intermediary 1. The setup I will show below integrates with Github Action’s Workflow Commands. Workflow commands allow the build scripts to enrich the feedback provided to developers.
For linters, such as clj-kondo
, Workflow commands can help highlight linter errors.
Instructions
-
Download this file into your project directory, i.e.
./bin/install-clj-kondo
. -
Make the file executable:
chmod +x ./bin/install-clj-kondo
-
Create a Github Action File in your repository:
.github/workflows/pr.yml
name: Tests
on: [ push ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install clj-kondo
run: sudo ./bin/install-clj-kondo
- name: Run clj-kondo
run: |
clj-kondo --lint src --config '{:output {:pattern "::{{level}} file={{filename}},line={{row}},col={{col}}::{{message}}"}}'
-
Something to keep in mind with Third Party Github Actions is that you should strongly consider vetting 3rd Party Actions and pinning the versions to
sha
to reduce the likelihood of a Supply Chain Attack. ↩