Azure / Azure/static-web-apps

Environment variables with the "right" name unexpectedly overwrite explicitly bound parameters.

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

Description

An environment variable with the same name as one of the "with" parameters overrides that parameter.
This is contrary to what I expect when reading the documentation.

**To Reproduce**

1. define a github workflow like the following:
```
env:
APP_LOCATION: "/"

....

jobs:
build_and_deploy:
runs-on: ubuntu-latest
environment: production
name: Build and Deploy
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
working-directory: webdoc
run: |
mkdir -p build
cp src/index.html build/index.html
pwd

- name: Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
skip_app_build: true
skip_api_build: true
app_location: /webdoc/build
output_location: ''
```
2. trigger the workflow
4. it will fail with sth like
```
Try to validate location at: '/github/workspace'.
App Directory Location: '/' was found.
Try to validate location at: '/github/workspace/swa-db-connections'.
Looking for event info
Skipping step to build /github/workspace with Oryx
Failed to find a default file in the app artifacts folder (/). Valid default files: index.html,Index.html.
If your application contains purely static content, please verify that the variable 'app_location' in your workflow file points to the root of your application.
If your application requires build steps, please validate that a default file exists in the build output directory.
```
The reason is, that the env variable from the second line of the snippet overrides the parameter mapping from the second last line.

**Expected**
Either document this behaviour explicitly (then mapping the parameters in the `with` block becomes redundant.), or remove it.

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.