Skip to content

Fix: bash brace-expansion corrupts JSON in update-convert-tool workflow - #2

Draft
Power-Maverick with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-with-copilot
Draft

Fix: bash brace-expansion corrupts JSON in update-convert-tool workflow#2
Power-Maverick with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-with-copilot

Conversation

Copilot AI commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Embedding a GitHub Actions expression as a bash default value — "${VAR:-${{ expr }}}" — causes bash to append a stray } when the expanded value is a JSON object, producing invalid JSON and failing the step with "Invalid JSON for features workflow input".

Root cause

When ${{ steps.metadata.outputs.features }} expands to e.g. {"minAPI":"1.2.2","multiConnection":"optional"}, the resulting bash line is:

FEATURES_SOURCE="${INPUT_FEATURES:-{"minAPI":"1.2.2","multiConnection":"optional"}}"

Bash counts the {…} inside the default as a balanced brace pair, so the } from the YAML literal that was intended to close ${…} instead becomes a trailing character appended to the value — giving …optional"}} (invalid JSON).

Fix

Pass the metadata outputs as env: variables (GitHub Actions handles assignment safely) and use an explicit conditional fallback instead of the literal-JSON-as-default pattern:

env:
    INPUT_FEATURES: ${{ inputs.features }}
    METADATA_FEATURES: ${{ steps.metadata.outputs.features }}
# Before — corrupts JSON value when INPUT_FEATURES is set
FEATURES_SOURCE="${INPUT_FEATURES:-${{ steps.metadata.outputs.features }}}"

# After — safe, no literal JSON in the script body
FEATURES_SOURCE="${INPUT_FEATURES:-}"
if [ -z "$FEATURES_SOURCE" ] || [ "$FEATURES_SOURCE" = "null" ]; then
  FEATURES_SOURCE="$METADATA_FEATURES"
fi

Applied to both the Build tool metadata JSON and Update Supabase database steps in update-convert-tool.yml.

Copilot AI changed the title [WIP] Fix issue with Copilot integration Fix: bash brace-expansion corrupts JSON in update-convert-tool workflow Aug 1, 2026
Copilot AI requested a review from Power-Maverick August 1, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants