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
Copy file name to clipboardExpand all lines: action.yml
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,14 @@ inputs:
30
30
gcp_workload_identity_provider:
31
31
description: 'The Google Cloud Workload Identity Provider.'
32
32
required: false
33
+
gcp_token_format:
34
+
description: 'The token format for authentication. Set to "access_token" to generate access tokens (requires service account), or set to empty string for direct WIF. Can be "access_token" or "id_token".'
35
+
required: false
36
+
default: 'access_token'
37
+
gcp_access_token_scopes:
38
+
description: 'The access token scopes when using token_format "access_token". Comma-separated list of OAuth 2.0 scopes.'
if [[ "${INPUT_GCP_WORKLOAD_IDENTITY_PROVIDER_PRESENT:-false}" == "true" ]]; then
126
-
if [[ "${INPUT_GCP_PROJECT_ID_PRESENT:-false}" != "true" || "${INPUT_GCP_SERVICE_ACCOUNT_PRESENT:-false}" != "true" ]]; then
127
-
warn "When using Workload Identity Federation ('gcp_workload_identity_provider'), you must also provide 'gcp_project_id' and 'gcp_service_account'."
134
+
if [[ "${INPUT_GCP_PROJECT_ID_PRESENT:-false}" != "true" ]]; then
135
+
warn "When using Workload Identity Federation ('gcp_workload_identity_provider'), you must also provide 'gcp_project_id'."
136
+
fi
137
+
# Service account is required when using token_format (default behavior)
138
+
# Only optional when explicitly set to empty for direct WIF
139
+
if [[ "${INPUT_GCP_TOKEN_FORMAT}" != "" && "${INPUT_GCP_SERVICE_ACCOUNT_PRESENT:-false}" != "true" ]]; then
140
+
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."
128
141
fi
129
142
if [[ "${INPUT_USE_VERTEX_AI:-false}" == "${INPUT_USE_GEMINI_CODE_ASSIST:-false}" ]]; then
130
143
warn "When using Workload Identity Federation, you must set exactly one of 'use_vertex_ai' or 'use_gemini_code_assist' to 'true'."
Copy file name to clipboardExpand all lines: docs/authentication.md
+63-1Lines changed: 63 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,6 +170,10 @@ This is the standard method for authenticating directly with the Vertex AI API u
170
170
171
171
- A Google Cloud project with the **Vertex AI API** enabled.
172
172
173
+
**Approach 1: With Service Account (Default)**
174
+
175
+
This is the default authentication approach using a service account with access token generation.
176
+
173
177
**GitHub Configuration**
174
178
175
179
After running the `setup_workload_identity.sh` script, add the following variables to your repository's **Settings > Secrets and variables > Actions**:
@@ -196,6 +200,33 @@ After running the `setup_workload_identity.sh` script, add the following variabl
196
200
Explain this code
197
201
```
198
202
203
+
**Approach 2: Direct WIF (Without Service Account)**
204
+
205
+
Alternatively, you can use direct Workload Identity Federation without a service account by explicitly setting `gcp_token_format` to an empty string.
If you have a **Gemini Code Assist** subscription, you can configure the action to use it for authentication.
@@ -204,16 +235,20 @@ If you have a **Gemini Code Assist** subscription, you can configure the action
204
235
205
236
- A Google Cloud project with an active Gemini Code Assist subscription.
206
237
238
+
**Approach 1: With Service Account (Default)**
239
+
240
+
This is the default authentication approach using a service account with access token generation.
241
+
207
242
**GitHub Configuration**
208
243
209
244
After running the `setup_workload_identity.sh` script, add the following variables to your repository's **Settings > Secrets and variables > Actions**:
0 commit comments