social/.github/workflows/pre-commit.yml

36 lines
1.0 KiB
YAML
Raw Normal View History

2021-10-17 17:07:28 +02:00
name: pre-commit
on:
pull_request:
2022-03-31 17:46:11 +02:00
branches:
- "15.0*"
2021-10-17 17:07:28 +02:00
push:
2022-03-31 17:46:11 +02:00
branches:
- "15.0"
- "15.0-ocabot-*"
2021-10-17 17:07:28 +02:00
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
2022-03-31 17:46:11 +02:00
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
2021-11-10 22:41:15 +01:00
with:
2022-03-31 17:46:11 +02:00
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi