From 58ecc5a510800efd1b991a0213de2c5a7fb1d093 Mon Sep 17 00:00:00 2001 From: Patryk Andrzejewski Date: Tue, 14 Nov 2023 13:22:30 +0100 Subject: [PATCH] Create instance when it is not exist instead of relying on pull request event (#4437) * Create instance * Create instance * Create instance --- .changeset/tiny-pumas-leave.md | 5 +++++ .github/workflows/pr-automation.yml | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .changeset/tiny-pumas-leave.md diff --git a/.changeset/tiny-pumas-leave.md b/.changeset/tiny-pumas-leave.md new file mode 100644 index 00000000000..c14d9bd29ec --- /dev/null +++ b/.changeset/tiny-pumas-leave.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Create instance when it has been not created yet diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index ab1b6050c5c..6571a43f54d 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -87,10 +87,19 @@ jobs: - name: Saleor login uses: ./.github/actions/cli-login with: - token: ${{ secrets.STAGING_TOKEN }} + token: ${{ secrets.STAGING_TOKEN }} + + - name: Instance check + id: instance_check + env: + SALEOR_CLI_ENV: staging + INSTANCE_NAME: ${{ needs.prepare_variables.outputs.POOL_NAME }} + run: | + INSTANCE_KEY=$(npx saleor env show "$INSTANCE_NAME" --json | jq .key) + echo "INSTANCE_KEY=$INSTANCE_KEY" >> $GITHUB_OUTPUT - name: Reload snapshot - if: ${{ github.event_name == 'pull_request' && github.event.action != 'opened' && github.event.action != 'closed' }} + if: ${{ steps.instance_check.outputs.INSTANCE_KEY }} env: SALEOR_CLI_ENV: staging BACKUP_ID: ${{ needs.prepare_variables.outputs.BACKUP_ID }} @@ -101,7 +110,7 @@ jobs: --skip-webhooks-update - name: Create new instance - if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }} + if: ${{ !steps.instance_check.outputs.INSTANCE_KEY }} env: SALEOR_CLI_ENV: staging BACKUP_ID: ${{ needs.prepare_variables.outputs.BACKUP_ID }}