Skip to content

Commit 9eacea0

Browse files
[CI] Add Lint workflow (#697)
The lint workflow runs git-hooks from `devenv` via `prek`. This mirrors the existing workflow in https://github.com/crystal-lang/crystal/blob/23b1aadbf79273a258f6e7ec84fcac11f3c114df/.github/workflows/lint.yml
1 parent 4606397 commit 9eacea0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
permissions: {}
8+
9+
jobs:
10+
prek:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Download source
14+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
15+
with:
16+
persist-credentials: false
17+
fetch-depth: 0
18+
- uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31
19+
- uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # v16
20+
with:
21+
name: devenv
22+
- name: Install devenv.sh
23+
run: nix profile install nixpkgs#devenv
24+
- name: "Download target branch: ${{ github.base_ref || 'master' }}"
25+
run: git fetch origin "${TARGET_BRANCH}"
26+
- name: Run prek hooks for changes against target branch (${{ github.base_ref || 'master' }})
27+
run: prek run --from-ref "origin/${TARGET_BRANCH}" --to-ref HEAD
28+
shell: devenv shell bash -- -e {0}
29+
if: "${{ github.event_name != 'workflow_dispatch' }}"
30+
- name: Run prek on all files
31+
run: prek run --all-files
32+
shell: devenv shell bash -- -e {0}
33+
if: "${{ github.event_name == 'workflow_dispatch' }}"
34+
env:
35+
TARGET_BRANCH: "${{ github.base_ref || 'master' }}"

0 commit comments

Comments
 (0)