Skip to content

Commit

Permalink
Custom prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
manquer committed Sep 16, 2024
1 parent 4b6c07f commit 7c8d775
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
SERVICE_PREFIX: DEFAULT
env:
DEFAULT_TEST_KEY: DEFAULT_TEST_KEY
KV_TEST_KEY: DEFAULT_TEST_KEY
AZURE_CLIENT_ID: 6b37a34b-4496-47e2-ab31-1bc31926e797
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: 5a7d1f14-292f-4043-a73a-d0339418a1e1
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82123,9 +82123,9 @@ class KeyVaultClient {


async function setup(prefix) {
const items = (0,lodash.filter)(Object.keys(process.env), (i) => (0,lodash.startsWith)(i, `${prefix}_`));
const items = (0,lodash.filter)(Object.keys(process.env), (i) => (0,lodash.startsWith)(i, `${prefix}_`) || (0,lodash.startsWith)(i, `KV_`));
await PromiseExtended.map(items, async (k) => {
const key = k.split(`${prefix}_`)[1];
const key = (0,lodash.get)(k.split(`${prefix}_`), '1') || (0,lodash.get)(k.split(`KV_`), '1');
const value = await kv.getSecret(prefix, key);
core.exportVariable(key, value);
core.setSecret(`${value}`);
Expand Down
6 changes: 3 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { filter, startsWith } from 'lodash'
import { filter, startsWith, get } from 'lodash'
import * as core from '@actions/core'
import { PromiseExtended } from './promise'
import Kv from './kv'

export async function setup(prefix: string): Promise<void> {
const items = filter(Object.keys(process.env), (i: string) => startsWith(i, `${prefix}_`))
const items = filter(Object.keys(process.env), (i: string) => startsWith(i, `${prefix}_`) || startsWith(i, `KV_`))
await PromiseExtended.map(items, async (k: string): Promise<void> => {
const key = k.split(`${prefix}_`)[1]
const key = get(k.split(`${prefix}_`), '1') || get(k.split(`KV_`), '1')
const value: string = await Kv.getSecret(prefix, key)
core.exportVariable(key, value)
core.setSecret(`${value}`)
Expand Down

0 comments on commit 7c8d775

Please sign in to comment.