Skip to content

Commit 5356896

Browse files
committed
[UPD] pre-commit workflow file, based on latest OCA template
1 parent 913309e commit 5356896

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,27 @@ on:
66

77
jobs:
88
pre-commit:
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-python@v4
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
1313
with:
14-
# The pylint-odoo version we use here does not support python 3.10
15-
# https://github.com/OCA/oca-addons-repo-template/issues/80
16-
python-version: "3.9"
17-
- uses: pre-commit/action@v2.0.0
14+
python-version: "3.11"
15+
- name: Get python version
16+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
17+
- uses: actions/cache@v4
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
21+
- name: Install pre-commit
22+
run: pip install pre-commit
23+
- name: Run pre-commit
24+
run: pre-commit run --all-files --show-diff-on-failure --color=always
25+
- name: Check that all files generated by pre-commit are in git
26+
run: |
27+
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
28+
if [ "$newfiles" != "" ] ; then
29+
echo "Please check-in the following files:"
30+
echo "$newfiles"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)