File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 105105 required : false
106106 type : string
107107 default : uv build
108+ secrets :
109+ TEST_SECRETS :
110+ description : JSON object containing test secrets to be unfurled as environment variables
111+ required : false
108112
109113jobs :
110114 python-ci :
@@ -156,8 +160,23 @@ jobs:
156160
157161 - name : Test
158162 if : ${{ inputs.run-tests }}
159- run : ${{ inputs.test-script }}
160- env : ${{ fromJson(inputs.test-environment-variables) }}
163+ run : |
164+ # Parse and export environment variables from JSON
165+ # Handle empty or null TEST_SECRETS
166+ if [ -z "$TEST_SECRETS" ] || [ "$TEST_SECRETS" = "null" ]; then
167+ TEST_SECRETS='{}'
168+ fi
169+
170+ # Use jq to merge JSON objects, with TEST_SECRETS taking precedence
171+ echo "$TEST_ENV_VARS $TEST_SECRETS" | jq -s '.[0] * .[1]' | jq -r 'to_entries[] | "export \(.key)=\(.value)"' | while IFS= read -r line; do
172+ eval "$line"
173+ done
174+
175+ # Run the test script
176+ ${{ inputs.test-script }}
177+ env :
178+ TEST_ENV_VARS : ' ${{ inputs.test-environment-variables }}'
179+ TEST_SECRETS : ' ${{ secrets.TEST_SECRETS }}'
161180
162181 - name : Publish coverage
163182 if : ${{ inputs.publish-coverage-path }}
You can’t perform that action at this time.
0 commit comments