Azure / Azure/static-web-apps

Cannot deploy named environment from GitHub PR action

Open
#1,644 1 comment 8 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

When trying to use Azure/static-web-apps-deploy@v1 GitHub action to deploy a **named** environment when triggering the action from a Pull request, the result is that a Pull request environment is deployed instead of named environment.

The issue with having PR-environment instead of a named environment is that the resulting URL is changing between deployments. This causes CORS problems for me when trying to use existing staging backend with the updated frontend.

**To Reproduce**
Steps to reproduce the behavior:
1. Define the GitHub action below
2. Trigger the Pull request action by creating, editing, etc. a Pull Request
3. Wait for the deployment to happen
4. A PR-environment with name like "-" is created instead of "preview"

Some unnecessary details have been removed from the below job
```
build_and_deploy_preview:
if: github.event_name == 'pull_request' # Trigger from pull request
name: Build and Deploy Preview Job
steps:
- uses: actions/checkout@v3
- name: Build And Deploy Preview
id: builddeploypreview
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "upload"
deployment_environment: "preview" # Define named environment
```

**Expected behavior**
An environment with the defined name from `deployment_environment` should be created/updated

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.