-
Notifications
You must be signed in to change notification settings - Fork 10
39 lines (37 loc) · 1.16 KB
/
pre-commit.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
name: pre-commit
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
jobs:
pre-commit:
name: "pre-commit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
- name: Parse Python version from runtime.txt
run: |
sed 's/[^0-9.]//g' runtime.txt | head > .python-version
- name: Set up Python
uses: actions/setup-python@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies with Poetry
run: |
poetry install --no-root --with=dev --no-interaction --no-ansi
# add virtual environment to path for future steps
echo $(poetry env info --path)/bin >> $GITHUB_PATH
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
with:
# only check changed files
extra_args: "--files ${{ steps.changed-files.outputs.all_changed_files }}"