You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Emit a clear warning in three places without failing the step
113
-
warn() {
114
-
local msg="$1"
115
-
echo "WARNING: ${msg}" >&2
116
-
echo "::warning title=Input validation::${msg}"
117
-
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
118
-
{
119
-
echo "### Input validation warnings"
120
-
echo
121
-
echo "- ${msg}"
122
-
} >> "${GITHUB_STEP_SUMMARY}"
123
-
fi
124
-
}
125
-
126
-
# Validate the count of authentication methods
127
-
auth_methods=0
128
-
if [[ "${INPUT_GEMINI_API_KEY_PRESENT:-false}" == "true" ]]; then ((++auth_methods)); fi
129
-
if [[ "${INPUT_GOOGLE_API_KEY_PRESENT:-false}" == "true" ]]; then ((++auth_methods)); fi
130
-
if [[ "${INPUT_GCP_WORKLOAD_IDENTITY_PROVIDER_PRESENT:-false}" == "true" ]]; then ((++auth_methods)); fi
131
-
132
-
if [[ ${auth_methods} -eq 0 ]]; then
133
-
warn "No authentication method provided. Please provide one of 'gemini_api_key', 'google_api_key', or 'gcp_workload_identity_provider'."
134
-
fi
135
-
136
-
if [[ ${auth_methods} -gt 1 ]]; then
137
-
warn "Multiple authentication methods provided. Please use only one of 'gemini_api_key', 'google_api_key', or 'gcp_workload_identity_provider'."
138
-
fi
139
-
140
-
# Validate Workload Identity Federation inputs
141
-
if [[ "${INPUT_GCP_WORKLOAD_IDENTITY_PROVIDER_PRESENT:-false}" == "true" ]]; then
142
-
if [[ "${INPUT_GCP_PROJECT_ID_PRESENT:-false}" != "true" ]]; then
143
-
warn "When using Workload Identity Federation ('gcp_workload_identity_provider'), you must also provide 'gcp_project_id'."
144
-
fi
145
-
# Service account is required when using token_format (default behavior)
146
-
# Only optional when explicitly set to empty for direct WIF
147
-
if [[ "${INPUT_GCP_TOKEN_FORMAT}" != "" && "${INPUT_GCP_SERVICE_ACCOUNT_PRESENT:-false}" != "true" ]]; then
148
-
warn "When using Workload Identity Federation with token generation ('gcp_token_format'), you must also provide 'gcp_service_account'. To use direct WIF without a service account, explicitly set 'gcp_token_format' to an empty string."
149
-
fi
150
-
if [[ "${INPUT_USE_VERTEX_AI:-false}" == "${INPUT_USE_GEMINI_CODE_ASSIST:-false}" ]]; then
151
-
warn "When using Workload Identity Federation, you must set exactly one of 'use_vertex_ai' or 'use_gemini_code_assist' to 'true'."
152
-
fi
153
-
fi
154
-
155
-
# Validate Vertex AI API Key
156
-
if [[ "${INPUT_GOOGLE_API_KEY_PRESENT:-false}" == "true" ]]; then
157
-
if [[ "${INPUT_USE_VERTEX_AI:-false}" != "true" ]]; then
158
-
warn "When using 'google_api_key', you must set 'use_vertex_ai' to 'true'."
159
-
fi
160
-
if [[ "${INPUT_USE_GEMINI_CODE_ASSIST:-false}" == "true" ]]; then
161
-
warn "When using 'google_api_key', 'use_gemini_code_assist' cannot be 'true'."
162
-
fi
114
+
working-directory: '${{ github.action_path }}'
115
+
run: |
116
+
if [[ "${{ inputs.use_pnpm }}" == "true" ]]; then
117
+
pnpm install --silent --no-audit --prefer-offline
118
+
else
119
+
npm ci --silent --no-audit
163
120
fi
164
121
165
-
# Validate Gemini API Key
166
-
if [[ "${INPUT_GEMINI_API_KEY_PRESENT:-false}" == "true" ]]; then
167
-
if [[ "${INPUT_USE_VERTEX_AI:-false}" == "true" || "${INPUT_USE_GEMINI_CODE_ASSIST:-false}" == "true" ]]; then
168
-
warn "When using 'gemini_api_key', both 'use_vertex_ai' and 'use_gemini_code_assist' must be 'false'."
echo "::warning::Gemini CLI debug logging is enabled. This will stream responses, which could reveal sensitive information if processed with untrusted inputs."
296
246
echo "::: Start Gemini CLI STDOUT :::"
297
-
if ! gemini --debug --yolo --prompt "${PROMPT}" --output-format json 2> >(tee "${TEMP_STDERR}" >&2) | tee "${TEMP_STDOUT}"; then
247
+
if ! gemini --debug --yolo --prompt "${PROMPT}" 2> >(tee "${TEMP_STDERR}" >&2) | tee "${TEMP_STDOUT}"; then
298
248
FAILED=true
299
249
fi
300
250
# Wait for async stderr logging to complete. This is because process substitution in Bash is async so let tee finish writing to ${TEMP_STDERR}
301
251
sleep 1
302
252
echo "::: End Gemini CLI STDOUT :::"
303
253
else
304
-
if ! gemini --yolo --prompt "${PROMPT}" --output-format json 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
254
+
if ! gemini --yolo --prompt "${PROMPT}" 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
0 commit comments