From ee182abeaef16085e4f76a2b6fe9a24160737696 Mon Sep 17 00:00:00 2001 From: sjoerdbeentjes <11621275+sjoerdbeentjes@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:31:57 +0200 Subject: [PATCH] temp test --- .github/workflows/main-migrations.yaml | 43 +++++++++++++++++++ .../{ => old}/staging-migrations.yaml | 0 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/main-migrations.yaml rename .github/workflows/{ => old}/staging-migrations.yaml (100%) diff --git a/.github/workflows/main-migrations.yaml b/.github/workflows/main-migrations.yaml new file mode 100644 index 00000000..b062ba1a --- /dev/null +++ b/.github/workflows/main-migrations.yaml @@ -0,0 +1,43 @@ +name: Apply main migrations on PR merge + +on: + pull_request: + types: [opened, synchronize] + +jobs: + apply-main-migrations: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check for changes in migrations folder + id: check_changes + run: | + git fetch origin main + + if git diff --quiet HEAD^ HEAD migrations; then + echo "CHANGES=false" >> $GITHUB_ENV + else + echo "CHANGES=true" >> $GITHUB_ENV + fi + + - name: Set up Node.js + if: ${{ env.CHANGES == 'true' }} + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + if: ${{ env.CHANGES == 'true' }} + run: npm install --force + + - name: Run TypeScript script + if: ${{ env.CHANGES == 'true' }} + env: + DATO_API_KEY_OPENEARTH_RWS_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_RWS_VIEWER }} + DATO_API_KEY_OPENEARTH_DATA_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_DATA_VIEWER }} + DATO_API_KEY_NL2120: ${{ secrets.DATO_API_KEY_NL2120 }} + run: npm run migrations:apply-main diff --git a/.github/workflows/staging-migrations.yaml b/.github/workflows/old/staging-migrations.yaml similarity index 100% rename from .github/workflows/staging-migrations.yaml rename to .github/workflows/old/staging-migrations.yaml