-
Notifications
You must be signed in to change notification settings - Fork 36
63 lines (52 loc) · 1.65 KB
/
pre-commit.yaml
File metadata and controls
63 lines (52 loc) · 1.65 KB
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
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
---
name: Pre-commit
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8.0]
os: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
- name: Cache python ${{ matrix.python-version }}
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/Python/${{ matrix.python-version }}
key: >-
${{ matrix.os }}-${{ matrix.python-version }}-pre-commit-
${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements_linter.txt') }}
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements_linter.txt
- name: Cache linters
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit for all files
run: |
pre-commit run --all-files
git log --format=%B --no-merges -n 1 > commit-msg
pre-commit run --commit-msg-filename commit-msg --hook-stage commit-msg gitlint
- name: Run pre-commit for commit files
if: always()
run: |
git reset --soft HEAD~1
pre-commit run