Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

[Github Actions] Set pull request environment name #1074

Open chatelain-io opened 1 year ago

chatelain-io commented 1 year ago

A new preview environment is created per pull request which create a new subdomain with the pull request number. My static web app is configured with custom authentication using Azure Active Directory. In the app registration, you must specify the redirect uri. The redirect uri do not support wildcard at the subdomain level so we need to automate the creation of the redirecturi for that specific pull request in a pipeline. Currently you can set the production branch (production_branch) name and the deployment environment (deployment_environment) for feature branches but you cannot change the pull request environment name.

It would be a nice feature to add an attribute to be able to configure the pull request environment name.

- name: Deploy
  uses: Azure/static-web-apps-deploy@v1
  with:
    ...
    production_branch: "main"
    deployment_environment: "dev"
    pr_environment: "pr"
   ....
MrMossevig commented 9 months ago

In theory youu could do this by: deployment_environment: ${{ github.event_name == 'pull_request' && 'pr' || 'dev' }} but there is currently a bug that is not naming the PR-environments correctly.