Azure / Azure/static-web-apps

Environments blade shows incorrect branch for named preview environments

Open
#1,005 3 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
In the portal, the Environments blade displays the branch name of the first branch deployed to a named preview environment, but is not updated on subsequent deployments. This issue was encountered while using GitHub Actions to deploy.

**Expected behavior**
The branch displayed in the Environments blade should always reflect the branch deployed in that environment.

**To Reproduce**

1. Follow the [Quickstart tutorial](https://learn.microsoft.com/en-us/azure/static-web-apps/get-started-portal?tabs=angular&pivots=github) to build a static web app. This tutorial uses the Angular template app found [here](https://github.com/login?return_to=%2Fstaticwebdev%2Fangular-basic%2Fgenerate).
2. Update the "Azure Static Web Apps CI/CD" workflow as follows:
```
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- "**" # <-- Change this so that the workflow runs for all branches
pull_request:
...

jobs:
build_and_deploy_job:
...
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
...
deployment_environment: "testing" # <-- Deploy to a named preview environment called "testing"
```
3. Push these changes to the `main` branch. After the workflow runs, verify that a new preview environment has been created. This should be reflected in the Environments blade of the Azure portal.

Screen Shot 2022-12-02 at 4 56 11 PM

5. Create a new branch from `main`, call it `feature-1`. Push this branch to trigger a workflow run, which will deploy it to the "testing" preview environment. When this workflow completes successfully, I expect to see the branch name `feature-1` in the portal, but it still displays `main`. The "Last Update Time" reflects the most recent deployment, but "Branch" does not.

Screen Shot 2022-12-02 at 5 01 48 PM

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.