From f312e634c6adaff706fade0bc5d7666bbfc230bc Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 27 May 2022 07:19:11 -0400 Subject: [PATCH] don't deploy preview if auto-merge enabled (#27949) --- .github/workflows/azure-preview-env-deploy.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/azure-preview-env-deploy.yml b/.github/workflows/azure-preview-env-deploy.yml index 72d580c009..63c21be31a 100644 --- a/.github/workflows/azure-preview-env-deploy.yml +++ b/.github/workflows/azure-preview-env-deploy.yml @@ -198,7 +198,16 @@ jobs: # Deploy ARM template is idempotent # Note: once the resources exist the image tag must change for a new deployment to occur (the image tag includes workflow run number, run attempt, as well as sha) - name: Run ARM deploy - id: deploy + # This 'if' will be truth, if this workflow is... + # - run as a workflow_dispatch + # - run because of a push to main (or gh-readonly-queue/main) + # - run as a regular pull request + # But if it's a pull request, *and* for whatever reason, the pull + # request has "Auto-merge" enabled, don't bother. + # The idea is that if auto-merge has been abled, by humans or by + # bots, they have no intention of viewing the deployed preview anyway. + # This saves time because the PR can merge sooner. + if: ${{ !github.event.pull_request.auto_merge }} uses: azure/arm-deploy@841b12551939c88af8f6df767c24c38a5620fd0d with: resourceGroupName: ${{ secrets.PREVIEW_ENV_RESOURCE_GROUP }}