Skip to content

Commit d16ed2f

Browse files
committed
chore: more graceful error on missing GITHUB_TOKEN in codegen
1 parent 61965fd commit d16ed2f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

codegen.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ import dotenv from 'dotenv';
33

44
dotenv.config();
55

6+
if (!process.env.GITHUB_TOKEN) {
7+
console.warn(
8+
'\x1b[33m⚠ GITHUB_TOKEN is not set. Skipping GraphQL codegen.\n' +
9+
' To generate updated types, create a .env file with a valid GitHub PAT.\n' +
10+
' See .env.template for details.\x1b[0m',
11+
);
12+
process.exit(0);
13+
}
14+
615
const config: CodegenConfig = {
716
overwrite: true,
817
schema: {
918
'https://api.github.com/graphql': {
10-
// Add a custom header for authorization using your PAT
1119
headers: {
1220
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
1321
},

0 commit comments

Comments
 (0)