-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (66 loc) · 1.98 KB
/
ci-linter-pre_commit_hooks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Leka - iOS Monorepo
# Copyright APF France handicap
# SPDX-License-Identifier: Apache-2.0
name: Linter - pre-commit hooks
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
swift_format:
name: pre-commit hooks
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
files: [changed_files, all_files]
permissions:
pull-requests: write
steps:
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v2
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
lfs: true
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: "pip"
- name: Set up mise
uses: jdx/mise-action@v2
with:
version: 2024.12.4
install: true
cache: true
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit --version
- name: Install tools
run: |
npm install -g ajv-cli
pre-commit install
pre-commit autoupdate
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
pre-commit-
- name: Run pre-commit hooks --all-files
if: matrix.files == 'all_files'
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
pre-commit gc
- name: Run pre-commit hooks --files
if: matrix.files == 'changed_files'
run: |
pre-commit run --show-diff-on-failure --color=always --files $(git diff --name-only -r HEAD^1 HEAD --diff-filter=AMCR)