check-if-migration-is-required.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: check migration
  2. on: pull_request
  3. jobs:
  4. should-check:
  5. name: did files change
  6. runs-on: ubuntu-20.04
  7. timeout-minutes: 3
  8. # Map a step output to a job output
  9. outputs:
  10. changed: ${{ steps.changes.outputs.migration_lockfile }}
  11. steps:
  12. - name: Checkout sentry
  13. uses: actions/checkout@v2
  14. - name: check if files have changed
  15. uses: getsentry/paths-filter@v2
  16. id: changes
  17. with:
  18. token: ${{ github.token }}
  19. filters: .github/file-filters.yml
  20. main:
  21. name: check migration
  22. runs-on: ubuntu-20.04
  23. needs: [should-check]
  24. if: needs.should-check.outputs.changed == 'true'
  25. steps:
  26. - name: Checkout sentry
  27. uses: actions/checkout@v2
  28. - name: Set python version output
  29. id: python-version
  30. run: |
  31. echo "::set-output name=python-version::$(cat .python-version)"
  32. # Until GH composite actions can use `uses`, we need to setup python here
  33. - uses: actions/setup-python@v2
  34. with:
  35. python-version: ${{ steps.python-version.outputs.python-version }}
  36. - name: Setup pip
  37. uses: ./.github/actions/setup-pip
  38. id: pip
  39. - name: pip cache
  40. uses: actions/cache@v2
  41. with:
  42. path: ${{ steps.pip.outputs.pip-cache-dir }}
  43. key: ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ secrets.PIP_CACHE_VERSION }}-${{ hashFiles('requirements-*.txt', '!requirements-pre-commit.txt') }}
  44. - name: Setup sentry env
  45. uses: ./.github/actions/setup-sentry
  46. id: setup
  47. - name: Migration & lockfile checks
  48. env:
  49. SENTRY_LOG_LEVEL: ERROR
  50. PGPASSWORD: postgres
  51. run: |
  52. ./.github/workflows/scripts/migration-check.sh