Skip to content

Commit 31270e2

Browse files
author
Andrei Bratu
committed
fix CI issue
1 parent a363df7 commit 31270e2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/integration/evals.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,25 @@ interface TestSetup {
3333
stagingEnvironmentId: string;
3434
}
3535

36+
function readEnvironment() {
37+
if (![process.env.HUMANLOOP_API_KEY, process.env.OPENAI_API_KEY].every(Boolean)) {
38+
// Testing locally not in CI, running dotenv.config() would override the secrets set for GitHub Action
39+
dotenv.config({});
40+
}
41+
if (!process.env.HUMANLOOP_API_KEY) {
42+
throw new Error("HUMANLOOP_API_KEY is not set");
43+
}
44+
if (!process.env.OPENAI_API_KEY) {
45+
throw new Error("OPENAI_API_KEY is not set for integration tests");
46+
}
47+
}
48+
3649
describe("Evals", () => {
3750
let humanloopClient: HumanloopClient;
3851
let openaiApiKey: string;
3952

4053
beforeAll(async () => {
41-
dotenv.config();
54+
readEnvironment();
4255
if (!process.env.HUMANLOOP_API_KEY) {
4356
throw new Error("HUMANLOOP_API_KEY is not set");
4457
}

0 commit comments

Comments
 (0)