You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. name: pre-commit
  2. on:
  3. pull_request:
  4. branches:
  5. - "14.0*"
  6. push:
  7. branches:
  8. - "14.0"
  9. - "14.0-ocabot-*"
  10. jobs:
  11. pre-commit:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v2
  15. - uses: actions/setup-python@v2
  16. - name: Get python version
  17. run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
  18. - uses: actions/cache@v1
  19. with:
  20. path: ~/.cache/pre-commit
  21. key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
  22. - name: Install pre-commit
  23. run: pip install pre-commit
  24. - name: Run pre-commit
  25. run: pre-commit run --all-files --show-diff-on-failure --color=always
  26. - name: Check that all files generated by pre-commit are in git
  27. run: |
  28. newfiles="$(git ls-files --others --exclude-from=.gitignore)"
  29. if [ "$newfiles" != "" ] ; then
  30. echo "Please check-in the following files:"
  31. echo "$newfiles"
  32. exit 1
  33. fi