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.

37 lines
1.1 KiB

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