Reputation: 7264
When setting up an Azure Static WebApp when I chose GitHub as the source provider, the UI provides an option to choose from one of the existing branches. But once the app is created I don't see any option to change the source. Whereas in Azure "App Service", you can disconnect from GitHub and establish the connection again with a different branch.
So, Is it possible to change the source branch in Azure SWA?
Upvotes: 7
Views: 6063
Reputation: 140
For anyone also struggling with this issue not using Pipelines or anything else; the data shown in the Azure Portal is basically just the values from the .yml file that is generated when you connect the repository to the static web app.
So you can just edit the branch in the corresponding file, e.g.
azure-static-web-apps-xxx.yml
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
[...]
replace main with whatever branch you want to deploy in the future. After pushing these changes the static web app should reflect these changes in the portal.
Upvotes: 5
Reputation: 108
You might've sorted it out by now, but this confused me as well and it turns out that you set this up on the deployment setup. In my case I'm using DevOps/Pipelines, and on the pipeline (equivalent to Github Actions) you can choose which branch to source from. Then you run the pipeline, and that will automatically change the source in the Static Web app.
Upvotes: 7