From bc3c6ade41d35227ffbf2127091a6024d9590c8c Mon Sep 17 00:00:00 2001 From: sjoerdbeentjes <11621275+sjoerdbeentjes@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:23:37 +0200 Subject: [PATCH 1/3] Add staging migrations workflow for PRs --- .github/workflows/staging-migrations.yaml | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/staging-migrations.yaml diff --git a/.github/workflows/staging-migrations.yaml b/.github/workflows/staging-migrations.yaml new file mode 100644 index 00000000..2d761c54 --- /dev/null +++ b/.github/workflows/staging-migrations.yaml @@ -0,0 +1,40 @@ +name: Apply staging migrations on PR when there are changes in the migrations folder + +on: + pull_request: + types: [opened, synchronize] + +jobs: + check-folder-changes: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Check for changes in specific folder + id: check_changes + run: | + if git diff --name-only origin/main...HEAD | grep -q '^src/specific-folder/'; then + echo "changes=true" >> $GITHUB_ENV + else + echo "changes=false" >> $GITHUB_ENV + fi + + apply-staging: + needs: check-folder-changes + if: env.changes == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: npm install + + - name: Run TypeScript script + run: npm run migrations:apply-staging From d1cf4bfe44f25c8dc7536217dd2cbf777ac1f644 Mon Sep 17 00:00:00 2001 From: sjoerdbeentjes <11621275+sjoerdbeentjes@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:23:48 +0200 Subject: [PATCH 2/3] Enable maintenance mode before listing environments --- scripts/dato/apply-main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/dato/apply-main.ts b/scripts/dato/apply-main.ts index ff450393..35b19357 100644 --- a/scripts/dato/apply-main.ts +++ b/scripts/dato/apply-main.ts @@ -9,6 +9,8 @@ async function main() { const client = new DatoClient(instance.key); + await client.runCommand(["maintenance:on"]); + const existingEnvironments = await client.listEnvironments(); const stagingExists = existingEnvironments?.some( From 41aa54295e51af06b26f6f591f1e9297f2bc3968 Mon Sep 17 00:00:00 2001 From: sjoerdbeentjes <11621275+sjoerdbeentjes@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:25:12 +0200 Subject: [PATCH 3/3] temp disable instances --- config/dato/instances.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/dato/instances.js b/config/dato/instances.js index 79d5a7d8..b150893f 100644 --- a/config/dato/instances.js +++ b/config/dato/instances.js @@ -7,12 +7,12 @@ module.exports.instances = [ name: "nl2120", key: process.env.DATO_API_KEY_NL2120, }, - { - name: "openearth-data-viewer", - key: process.env.DATO_API_KEY_OPENEARTH_DATA_VIEWER, - }, - { - name: "openearth-rws-viewer", - key: process.env.DATO_API_KEY_OPENEARTH_RWS_VIEWER, - }, + // { + // name: "openearth-data-viewer", + // key: process.env.DATO_API_KEY_OPENEARTH_DATA_VIEWER, + // }, + // { + // name: "openearth-rws-viewer", + // key: process.env.DATO_API_KEY_OPENEARTH_RWS_VIEWER, + // }, ];