Skip to content

Commit 311055b

Browse files
author
David Cavazos
committed
inspect env vars
1 parent aa9c00d commit 311055b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"workload-identity-provider": "projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider",
2424
"service-account": "[email protected]",
2525
"access-token-lifetime": "600s", // 10 minutes
26+
"env": null,
2627
"secrets": null
2728
},
2829
"ignore": [

.github/workflows/ci-dev.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
path: ${{ fromJson(github.event_name == 'pull_request' && needs.affected.outputs.nodejs-paths || '[]') }}
6565
env:
6666
CI_SETUP: ${{ toJson(fromJson(needs.affected.outputs.nodejs-setups)[matrix.path])}}
67-
GOOGLE_SAMPLES_PROJECT: ${{ fromJson(needs.affected.outputs.nodejs-setups)[matrix.path].project-id }}
6867
steps:
6968
- name: CI Setup
7069
run: echo "${{ env.CI_SETUP }}"
@@ -86,12 +85,15 @@ jobs:
8685
uses: actions/github-script@v7
8786
with:
8887
script: |
89-
console.log("Hello")
90-
// CI_SETUP: ${{ fromJson(env.CI_SETUP) }}
91-
// GOOGLE_SAMPLES_PROJECT: ${{ fromJson(env.CI_SETUP).project }}
92-
console.log(typeof env)
93-
console.log(JSON.stringify(env))
94-
console.log(${{ fromJson(env.CI_SETUP).project }})
88+
const setup = JSON.parse(process.env.CI_SETUP)
89+
const env = {
90+
'GOOGLE_SAMPLES_PROJECT': setup['project-id'],
91+
...(setup.env || {})
92+
}
93+
for (const key in env) {
94+
console.log(`${key}: ${env[key]}`)
95+
core.exportVariable(key, env[key])
96+
}
9597
- name: Get Secret Manager secrets
9698
uses: google-github-actions/get-secretmanager-secrets@v2
9799
if: fromJson(env.CI_SETUP).secrets != null

generative-ai/snippets/ci-setup.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"node-version": 18,
3+
"env": {
4+
"MY_ENV_VAR": 42
5+
},
36
"secrets": [
47
"CAIP_PROJECT_ID:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-caip-project-id",
58
"LOCATION:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-location",

0 commit comments

Comments
 (0)