Skip to content

Commit

Permalink
feat(auth): add service account auth for Vertex AI
Browse files Browse the repository at this point in the history
- Add GOOGLE_VERTEX_SA_KEY_B64 input for base64 credentials
- Support service account authentication via googleAuthOptions
  • Loading branch information
herniqeu committed Nov 20, 2024
1 parent 89c677c commit ad44394
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ inputs:
COOKBOOK_URL:
description: "URL to fetch validation rules cookbook from"
required: true
GOOGLE_VERTEX_SA_KEY_B64:
description: "Base64 encoded Google service account key for Vertex AI authentication"
required: false

runs:
using: "node20"
Expand Down
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79254,6 +79254,7 @@ const COOKBOOK_URL = 'https://gist.githubusercontent.com/herniqeu/35669801a4bbdc
const GOOGLE_API_KEY = core.getInput('GOOGLE_API_KEY');
const GOOGLE_VERTEX_PROJECT = core.getInput('GOOGLE_VERTEX_PROJECT');
const GOOGLE_VERTEX_LOCATION = core.getInput('GOOGLE_VERTEX_LOCATION') || 'us-central1';
const GOOGLE_VERTEX_SA_KEY_B64 = core.getInput('GOOGLE_VERTEX_SA_KEY_B64');
const octokit = new dist_node.Octokit({ auth: GITHUB_TOKEN });
const SKIP_VALIDATION_COMMENT = '// @skip-validation';
const logger = {
Expand Down Expand Up @@ -79303,7 +79304,10 @@ function resolveModel() {
google: createGoogleGenerativeAI({ apiKey: GOOGLE_API_KEY })('models/gemini-1.5-flash-latest'),
vertex: createVertex({
project: GOOGLE_VERTEX_PROJECT,
location: GOOGLE_VERTEX_LOCATION
location: GOOGLE_VERTEX_LOCATION,
googleAuthOptions: GOOGLE_VERTEX_SA_KEY_B64 ? {
credentials: JSON.parse(Buffer.from(GOOGLE_VERTEX_SA_KEY_B64, 'base64').toString())
} : undefined
})('gemini-1.5-pro')
};
const model = modelPerProvider[AI_PROVIDER];
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/src/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ad44394

Please sign in to comment.