Skip to content

Commit

Permalink
inspect env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcavazos committed Jan 21, 2025
1 parent aa9c00d commit 7119d52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"workload-identity-provider": "projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider",
"service-account": "[email protected]",
"access-token-lifetime": "600s", // 10 minutes
"env": null,
"secrets": null
},
"ignore": [
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/ci-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
path: ${{ fromJson(github.event_name == 'pull_request' && needs.affected.outputs.nodejs-paths || '[]') }}
env:
CI_SETUP: ${{ toJson(fromJson(needs.affected.outputs.nodejs-setups)[matrix.path])}}
GOOGLE_SAMPLES_PROJECT: ${{ fromJson(needs.affected.outputs.nodejs-setups)[matrix.path].project-id }}
steps:
- name: CI Setup
run: echo "${{ env.CI_SETUP }}"
Expand All @@ -86,12 +85,15 @@ jobs:
uses: actions/github-script@v7
with:
script: |
console.log("Hello")
// CI_SETUP: ${{ fromJson(env.CI_SETUP) }}
// GOOGLE_SAMPLES_PROJECT: ${{ fromJson(env.CI_SETUP).project }}
console.log(typeof env)
console.log(JSON.stringify(env))
console.log(${{ fromJson(env.CI_SETUP).project }})
const setup = JSON.parse(process.env.CI_SETUP)
const env = {
'GOOGLE_SAMPLES_PROJECT': setup['project-id'],
...(setup.env || {})
}
for (const key in setup.env) {
console.log(`${key}: ${setup.env[key]}`)
core.exportVariable(key, setup.env[key])
}
- name: Get Secret Manager secrets
uses: google-github-actions/get-secretmanager-secrets@v2
if: fromJson(env.CI_SETUP).secrets != null
Expand Down
3 changes: 3 additions & 0 deletions generative-ai/snippets/ci-setup.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"node-version": 18,
"env": {
"MY_ENV_VAR": 42
},
"secrets": [
"CAIP_PROJECT_ID:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-caip-project-id",
"LOCATION:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-location",
Expand Down

0 comments on commit 7119d52

Please sign in to comment.