From 2706c086ada4f80898166133e81f3405d2602e49 Mon Sep 17 00:00:00 2001 From: Nick Cipollina Date: Tue, 13 Oct 2026 21:09:25 -0400 Subject: [PATCH] fix(github): stop pr-build redirecting MSBuild output and fix cdk-preview jq pr-build exported its publish folder as an `outputPath` environment variable. MSBuild reads environment variables as properties, so every project in the solution built into that one folder and multi-project solutions overwrote each other's files (for example appsettings.json), failing their tests. The variable is now TEMPLATE_OUTPUT_PATH. cdk-preview's contextFromDeployed lookup used `capture($re)?.value`, which jq 1.7.1 (the GitHub-hosted runner's version) rejects as a syntax error. Use `first(.. | strings | capture($re)? | .value)`. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/cdk-preview.yaml | 2 +- .github/workflows/pr-build.yaml | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cdk-preview.yaml b/.github/workflows/cdk-preview.yaml index 5599e36..c26941f 100644 --- a/.github/workflows/cdk-preview.yaml +++ b/.github/workflows/cdk-preview.yaml @@ -206,7 +206,7 @@ jobs: done < <(jq -r '(.context // {}) | to_entries[] | [.key, .value] | @tsv' <<<"$entry") while IFS=$'\t' read -r key regex; do [[ -n "$key" ]] || continue - value=$(jq -r --arg re "$regex" '[.. | strings | capture($re)?.value] | first // empty' "$deployed") + value=$(jq -r --arg re "$regex" 'first(.. | strings | capture($re)? | .value) // empty' "$deployed") if [[ -z "$value" ]]; then echo "::error::$stack: no deployed template string matched contextFromDeployed.$key." failed=1 diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 215e83c..9c016ae 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -144,11 +144,13 @@ jobs: exit 1 - name: Set Default Output Path If Not Provided + # Not named outputPath: MSBuild reads environment variables as properties, and an `outputPath` + # variable would redirect every project's OutputPath into this one folder. run: | if [ -z "${{ inputs.outputPath }}" ]; then - echo "outputPath=${{ github.workspace }}/publish" >> $GITHUB_ENV + echo "TEMPLATE_OUTPUT_PATH=${{ github.workspace }}/publish" >> $GITHUB_ENV else - echo "outputPath=${{ github.workspace}}/${{ inputs.outputPath }}" >> $GITHUB_ENV + echo "TEMPLATE_OUTPUT_PATH=${{ github.workspace}}/${{ inputs.outputPath }}" >> $GITHUB_ENV fi - name: Validate .NET Inputs @@ -252,7 +254,7 @@ jobs: - name: Build and Publish Blazor WebAssembly if: inputs.webPath != '' - run: dotnet publish ${{ inputs.webPath }} --configuration "${{ inputs.buildConfiguration }}" --no-restore --output ${{ env.outputPath }} + run: dotnet publish ${{ inputs.webPath }} --configuration "${{ inputs.buildConfiguration }}" --no-restore --output ${{ env.TEMPLATE_OUTPUT_PATH }} - name: Detect Lambda custom build images id: lambda-custom-container @@ -278,7 +280,7 @@ jobs: functions: ${{ inputs.functions }} configuration: ${{ inputs.buildConfiguration }} lambdaRuntimeVersion: ${{ inputs.lambdaRuntimeVersion }} - outputPath: ${{ env.outputPath }} + outputPath: ${{ env.TEMPLATE_OUTPUT_PATH }} # Functions whose own aws-lambda-tools-defaults.json declares `container-image-for-build` were # already built and packaged by the step above, from an isolated checkout copy - see that @@ -297,7 +299,7 @@ jobs: echo "Skipping $NAME - already packaged by the Native AOT isolated-build step" continue fi - ZIP_PATH="${{ env.outputPath }}/${NAME}.zip" + ZIP_PATH="${{ env.TEMPLATE_OUTPUT_PATH }}/${NAME}.zip" dotnet tool run dotnet-lambda package -pl "$FUNC_PATH" --configuration "${{ inputs.buildConfiguration }}" --no-restore --framework ${{ inputs.lambdaRuntimeVersion }} --output-package "$ZIP_PATH" done @@ -414,11 +416,13 @@ jobs: exit 1 - name: Set Default Output Path If Not Provided + # Not named outputPath: MSBuild reads environment variables as properties, and an `outputPath` + # variable would redirect every project's OutputPath into this one folder. run: | if [ -z "${{ inputs.outputPath }}" ]; then - echo "outputPath=${{ github.workspace }}/publish" >> $GITHUB_ENV + echo "TEMPLATE_OUTPUT_PATH=${{ github.workspace }}/publish" >> $GITHUB_ENV else - echo "outputPath=${{ github.workspace}}/${{ inputs.outputPath }}" >> $GITHUB_ENV + echo "TEMPLATE_OUTPUT_PATH=${{ github.workspace}}/${{ inputs.outputPath }}" >> $GITHUB_ENV fi - name: Checkout Repository @@ -534,7 +538,7 @@ jobs: exit 1 fi - SITE_OUT="${{ env.outputPath }}/$OUTPUT_SUBDIR" + SITE_OUT="${{ env.TEMPLATE_OUTPUT_PATH }}/$OUTPUT_SUBDIR" rm -rf "$SITE_OUT" mkdir -p "$SITE_OUT" cp -a "$BUILD_OUT/." "$SITE_OUT/"