-
Notifications
You must be signed in to change notification settings - Fork 17
42 lines (33 loc) · 1.24 KB
/
pre-commit-action.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
name: Pre-Commit
on:
workflow_call:
inputs:
changed-files:
required: true
type: string
description: JSON string containing information about changed files
jobs:
Pre-Commit:
name: Pre-Commit Checks
runs-on: ubuntu-latest
steps:
- name: Install System Deps
run: |
sudo apt-get update
sudo apt-get install -y git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Pre-Commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit install --install-hooks
- name: Check ALL Files On Branch
if: github.event_name != 'pull_request'
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
- name: Check Changed Files On PR
if: github.event_name == 'pull_request' && fromJSON(inputs.changed-files)['repo'] == 'true'
run: |
pre-commit run --show-diff-on-failure --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}