name: migrations on: pull_request: paths: - 'src/sentry/migrations/*' jobs: sql: name: Generate SQL runs-on: ubuntu-16.04 timeout-minutes: 8 steps: # Checkout master to run all merged migrations. - uses: actions/checkout@v1 with: ref: master - name: Set python version output id: python-version run: | echo "::set-output name=python-version::$(cat .python-version)" # Until GH composite actions can use `uses`, we need to setup python here - uses: actions/setup-python@v2 with: python-version: ${{ steps.python-version.outputs.python-version }} - name: Setup pip uses: ./.github/actions/setup-pip id: pip - name: pip cache uses: actions/cache@v2 with: path: ${{ steps.pip.outputs.pip-cache-dir }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Setup sentry env uses: ./.github/actions/setup-sentry id: setup - name: Apply migrations run: | sentry upgrade --noinput # Checkout the current ref - uses: actions/checkout@v1 with: clean: false - name: Get changed migration files id: file run: | echo $(git diff --diff-filter=AM --name-only origin/master HEAD) echo "::set-output name=modified::$(git diff --diff-filter=AM --name-only origin/master HEAD | grep 'src/sentry/migrations/')" - name: Generate SQL for migration uses: getsentry/action-migrations@v1.0.7 env: SENTRY_LOG_LEVEL: ERROR with: githubToken: ${{ secrets.GITHUB_TOKEN }} migration: ${{ steps.file.outputs.modified }}