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
325 stars 56 forks source link

deployment_environment: doesn't work #1551

Open sonomirco opened 1 week ago

sonomirco commented 1 week ago

Describe the bug

I followed these link. https://learn.microsoft.com/en-us/azure/static-web-apps/named-environments?tabs=github-actions

https://github.com/Azure/static-web-apps/discussions/787

This is the action

name: Deploy documentation for development

on:
  workflow_dispatch:
  pull_request:
    types: [opened, synchronize, closed]
    branches:
      - develop
      - "dev/**"
      - "feat/**"
    paths:
      - "web/**"
      - "media/**"

jobs:
  deploy_dev_doc:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    environment:
      name: development
      url: https://mango-desert-0545fe40f-development.eastus2.5.azurestaticapps.net
    steps:
      - name: 🛎 Checkout
        uses: actions/checkout@v4
        with:
          submodules: true

      - name: 🚀 Build and deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_TOKEN }}
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          action: "upload"
          app_location: "./web"
          api_location: ""
          output_location: "build"
          deployment_environment: "development"

Expected behavior I should have this URL https://mango-desert-0545fe40f-development.eastus2.5.azurestaticapps.net generated in the Azure Static Web App, but I have this one https://mango-desert-0545fe40f-78.eastus2.5.azurestaticapps.net/.auth/login/aad/callback which it takes the PR's ID.

higharc91 commented 1 week ago

I am experiencing the same issue with my project.

sindrebakk1 commented 10 hours ago

I am experiencing the same result. This is blocking us from setting up a CORS policy for preview environments