Skip to content

Commit 1226d91

Browse files
author
David Cavazos
committed
made secrets and env consistent
1 parent 311055b commit 1226d91

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/ci-dev.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
access_token_lifetime: ${{ fromJson(env.CI_SETUP).access-token-lifetime }}
8484
- name: Export environment variables
8585
uses: actions/github-script@v7
86+
id: vars
8687
with:
8788
script: |
8889
const setup = JSON.parse(process.env.CI_SETUP)
@@ -94,11 +95,17 @@ jobs:
9495
console.log(`${key}: ${env[key]}`)
9596
core.exportVariable(key, env[key])
9697
}
98+
return {
99+
"env": env,
100+
"secrets": Object.keys(setup.secrets || {})
101+
.map(key => `${key}:${setup.secrets[key]}`)
102+
.join('\n'),
103+
}
97104
- name: Get Secret Manager secrets
98105
uses: google-github-actions/get-secretmanager-secrets@v2
99-
if: fromJson(env.CI_SETUP).secrets != null
106+
if: steps.vars.outputs.result.secrets != null
100107
with:
101-
secrets: ${{ join(fromJson(env.CI_SETUP).secrets) }}
108+
secrets: ${{ steps.vars.outputs.result.secrets }}
102109
export_to_environment: true
103110
- name: 🛠️ Test ${{ matrix.path }}
104111
run: |

generative-ai/snippets/ci-setup.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"env": {
44
"MY_ENV_VAR": 42
55
},
6-
"secrets": [
7-
"CAIP_PROJECT_ID:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-caip-project-id",
8-
"LOCATION:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-location",
9-
"DATASTORE_ID:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-datastore-id"
10-
]
6+
"secrets": {
7+
"CAIP_PROJECT_ID": "nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-caip-project-id",
8+
"LOCATION": "nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-location",
9+
"DATASTORE_ID": "nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-datastore-id"
10+
}
1111
}

0 commit comments

Comments
 (0)