1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- name: migrations
- on: pull_request
- # Cancel in progress workflows on pull_requests.
- # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
- concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
- defaults:
- run:
- # the default default is:
- # bash --noprofile --norc -eo pipefail {0}
- shell: bash --noprofile --norc -eo pipefail -ux {0}
- jobs:
- did-migration-change:
- name: check if any migration changes
- runs-on: ubuntu-22.04
- timeout-minutes: 3
- # Map a step output to a job output
- outputs:
- added: ${{ steps.changes.outputs.migrations_added }}
- modified: ${{ steps.changes.outputs.migrations_modified }}
- steps:
- - name: Checkout sentry
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- - name: Match migration files
- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
- id: changes
- with:
- token: ${{ github.token }}
- filters: .github/file-filters.yml
- sql:
- name: Generate SQL
- runs-on: ubuntu-22.04
- timeout-minutes: 8
- strategy:
- matrix:
- pg-version: ['14']
- needs: did-migration-change
- if: needs.did-migration-change.outputs.added == 'true'
- steps:
- # Checkout master to run all merged migrations.
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- with:
- ref: master
- - name: Setup sentry env
- uses: ./.github/actions/setup-sentry
- with:
- pg-version: ${{ matrix.pg-version }}
- - name: Apply migrations
- run: |
- sentry upgrade --noinput
- # Checkout the current ref
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- with:
- clean: false
- - name: Get changed migration files
- id: file
- run: |
- echo 'added<<EOF' >> "$GITHUB_OUTPUT"
- git diff --diff-filter=A --name-only origin/master HEAD -- 'src/sentry/*/migrations/' 'src/sentry/migrations/' >> "$GITHUB_OUTPUT"
- echo 'EOF' >> "$GITHUB_OUTPUT"
- - name: Generate SQL for migration
- uses: getsentry/action-migrations@4d8ed0388dfc0774302bbfd5204e518f9ac4f066 # main
- env:
- SENTRY_LOG_LEVEL: ERROR
- with:
- githubToken: ${{ secrets.GITHUB_TOKEN }}
- migration: ${{ steps.file.outputs.added }}
|