From 021024eefef354f330d6c380bb834657f4e6d7b5 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Wed, 22 Jan 2025 16:16:01 +0100 Subject: [PATCH] Use Bearer token in ci workflow When authenticating against a live dpl-cms site, we need to authenticate the request with a Bearer token --- codegen.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codegen.ts b/codegen.ts index c029ade..5c0def0 100644 --- a/codegen.ts +++ b/codegen.ts @@ -3,6 +3,7 @@ import type { CodegenConfig } from "@graphql-codegen/cli" import goConfig from "./lib/config/goConfig" const { loadEnvConfig } = require("@next/env") +const isCI = process.env.CI === "true" loadEnvConfig(process.cwd()) @@ -15,7 +16,7 @@ const config: CodegenConfig = { schema: { [`${process.env.NEXT_PUBLIC_GRAPHQL_SCHEMA_ENDPOINT_DPL_CMS}`]: { headers: { - Authorization: `Basic ${process.env.GRAPHQL_SCHEMA_ENDPOINT_BASIC_TOKEN_DPL_CMS}`, + Authorization: `${isCI ? "Bearer" : "Basic"} ${process.env.NEXT_PUBLIC_GRAPHQL_BASIC_TOKEN_DPL_CMS}`, }, }, },