Search code examples
azure-devopsazure-web-app-servicegithub-actions

How to prevent addition of new workflow yml file to GithHub repository triggering redeployment to Azure App Service?


Background:

I have one GitHub repo for a product which is deployed to multiple separate Azure web App Services. In the deployment centre (via the web portal) for each app service, I accepted the suggestion to create a workflow yml file, so that changes committed to the repo will trigger a redeployment. I believe this is achieved with GitHub Actions

This is useful to trigger redeployment when committing code changes to the main branch, however I am encountering an undesirable consequence of this setup:

  • Let's say for example that I have to deploy the same app for a new client. If I create another new app service or add a new deployment slot and (via deployment centre) connect it to the same GitHub repo, a workflow yml file will be created in the repo
  • The addition of this yml file to the repo triggers an app redeployment to all connected slots
  • This forces a restart (and therefore a few minutes down time for warm-up) on all existing app services. Not good!

Question:

Is there some way that I can prevent the addition of new yml workflow files to the repo from triggering redeployment?

What I tried:

  • Create a new App Service on Azure and connect it to a github repository to which several other App Services are also connected

What I expected to happen:

  • The new App Service would create a workflow to trigger redeployment when code changes are pushed to the GitHub repo, and the other App Services would not be affected by this

What actually resulted:

  • The new App Service created a workflow to trigger redeployment when code changes are pushed to the GitHub repo, but the addition of the workflow yml/yaml file to the GitHub repo triggered a redeployment to all connected app services, resulting in downtime

Solution

  • Given that my workflow .yml files are all added to the path .github/workflows/ by Azure, I was able to solve the problem by editing this section of the workflow .yml file from:

    on:
      push:
        branches:
          - thisbranch
      workflow_dispatch:
    

    To:

    on:
      push:
        branches:
          - thisbranch
        paths-ignore:
          - '.github/workflows/**'
      workflow_dispatch: