1
0

pre-commit.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Pre-Commit
  2. on: [push, pull_request]
  3. jobs:
  4. Pre-Commit:
  5. name: Run Pre-Commit Against Salt
  6. runs-on: ubuntu-latest
  7. container:
  8. image: python:3.8.6-slim-buster
  9. steps:
  10. - name: Install System Deps
  11. run: |
  12. apt-get update
  13. apt-get install -y enchant git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
  14. - uses: actions/checkout@v2
  15. - name: Set Pre-Commit Cache Key
  16. run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
  17. - name: Setup Pre-Commit Cache
  18. uses: pat-s/always-upload-cache@v2.1.3
  19. with:
  20. path: ~/.cache/pre-commit
  21. key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
  22. - id: changed-files
  23. name: Get Changed Files
  24. uses: dorny/paths-filter@v2
  25. with:
  26. token: ${{ github.token }}
  27. list-files: json
  28. filters: |
  29. repo:
  30. - added|modified:
  31. - '**'
  32. - name: Check ALL Files On Branch
  33. uses: pre-commit/action@v2.0.0
  34. if: github.event_name != 'pull_request'
  35. env:
  36. SKIP: lint-salt,lint-tests,pyupgrade,remove-import-headers,rstcheck
  37. - name: Check Changed Files On PR
  38. uses: pre-commit/action@v2.0.0
  39. if: github.event_name == 'pull_request' && steps.changed-files.outputs.repo == 'true'
  40. with:
  41. extra_args: --files ${{ join(fromJSON(steps.changed-files.outputs.repo_files), ' ') }}
  42. env:
  43. SKIP: lint-salt,lint-tests