Skip to content

Commit e2fd05b

Browse files
using chaavi
1 parent a903f3c commit e2fd05b

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

.github/workflows/check-jupyter-wip.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,43 @@ jobs:
3131
3232
- name: Generate configuration file from secrets
3333
env:
34-
NOTEBOOK_GCP_PROJECT_ID: ${{ vars.NOTEBOOK_GCP_PROJECT_ID }}
34+
TKF_CHAVI: ${{ secrets.TKF_PICHAI_BAADAL_CHAVI }}
35+
NOTEBOOK_GCP_PROJECT_ID: ${{ secrets.NOTEBOOK_GCP_PROJECT_ID }}
3536
NOTEBOOK_GCP_LOCATION: ${{ vars.NOTEBOOK_GCP_LOCATION }}
36-
run: |
37-
echo '{' > env.json
38-
echo ' "NOTEBOOK_GCP_PROJECT_ID": "'${NOTEBOOK_GCP_PROJECT_ID}'",' >> env.json
39-
echo ' "NOTEBOOK_GCP_LOCATION": "'${NOTEBOOK_GCP_LOCATION}'"' >> env.json
40-
echo '}' >> env.json
37+
#run: |
38+
# echo '{' > env.json
39+
# echo ' "NOTEBOOK_GCP_PROJECT_ID": "'${NOTEBOOK_GCP_PROJECT_ID}'",' >> env.json
40+
# echo ' "NOTEBOOK_GCP_LOCATION": "'${NOTEBOOK_GCP_LOCATION}'"' >> env.json
41+
# echo '}' >> env.json
4142

4243
- name: Run tests with pytest
4344
run: |
4445
pwd
45-
#jupyter nbconvert --to notebook --execute notebooks/GenAI/Gemini_Intro.ipynb
46-
pytest -s testing/test_notebooks.py
46+
import os
47+
import json
48+
from google.oauth2 import service_account
49+
50+
# Access the service account key from the environment variable
51+
service_account_key = os.environ.get("GCP_SERVICE_ACCOUNT_KEY")
52+
53+
if service_account_key is None:
54+
raise ValueError("Service account key is not set in environment variables.")
55+
56+
# Parse the JSON key
57+
key_data = json.loads(service_account_key)
58+
59+
# Authenticate with the service account key
60+
credentials = service_account.Credentials.from_service_account_info(key_data)
61+
62+
# (Optional) Use the credentials for API initialization
63+
from google.cloud import aiplatform
64+
65+
# Initialize Vertex AI Platform
66+
PROJECT_ID = os.environ.get("NOTEBOOK_GCP_PROJECT_ID")
67+
REGION = os.environ.get("NOTEBOOK_GCP_LOCATION")
68+
69+
aiplatform.init(project=PROJECT_ID, location=REGION, credentials=credentials)
70+
71+
jupyter nbconvert --to notebook --execute notebooks/GenAI/Gemini_Intro.ipynb
72+
#pytest -s testing/test_notebooks.py
4773

0 commit comments

Comments
 (0)