Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion extensions/github/.env.example

This file was deleted.

14 changes: 1 addition & 13 deletions extensions/github/.graphqlrc.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
import * as dotenv from "dotenv";
dotenv.config();

export default {
schema: [
{
"https://api.github.com/graphql": {
headers: {
Authorization: `token ${process.env.GITHUB_TOKEN}`,
"User-Agent": "Raycast",
},
},
},
],
schema: "schema/github.graphql",
documents: ["src/**/*.graphql"],
};
4 changes: 4 additions & 0 deletions extensions/github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# GitHub Changelog

## [Improve GraphQL Code Generation] - {PR_MERGE_DATE}

- Make GraphQL type generation deterministic and credential-free by using a checked-in GitHub schema.

## [View Pull Request Diffs] - 2026-08-06

- Added a "View Diff" action to pull requests, showing changed files with per-file patches that load progressively as you scroll.
Expand Down
8 changes: 4 additions & 4 deletions extensions/github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Contributing

1. Get a GitHub token to be able to generate the GraphQL types from [GraphQL Code Generator](https://www.the-guild.dev/graphql/codegen).
2. Run `cp .env.example .env`
3. Assign your created token to `GITHUB_TOKEN`
4. Run `npm run dev`. This will spawn two processes: one launching the Raycast command in development and the other watching for your GraphQL changes.
1. Run `npm ci` to install the extension's dependencies.
2. Run `npm run dev`. This will spawn two processes: one launching the Raycast command in development and the other watching for your GraphQL changes.

GraphQL types are generated from the checked-in GitHub schema, so generation does not require a GitHub token or network access. Run `npm run update-schema` to download the latest [public schema from GitHub Docs](https://github.com/github/docs/blob/main/src/graphql/data/fpt/schema.docs.graphql); this refresh requires network access but no authentication. Then regenerate the types with `npm run generate`.
38 changes: 23 additions & 15 deletions extensions/github/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import { CodegenConfig } from "@graphql-codegen/cli";
import * as dotenv from "dotenv";
dotenv.config();

const config: CodegenConfig = {
schema: [
{
"https://api.github.com/graphql": {
headers: {
Authorization: `token ${process.env.GITHUB_TOKEN}`,
"User-Agent": "Raycast",
},
},
},
],
schema: "schema/github.graphql",
documents: ["src/**/*.graphql"],
generates: {
"./src/generated/schema.ts": {
plugins: ["typescript"],
config: {
defaultScalarType: "any",
},
},
"./src/generated/graphql.ts": {
plugins: ["typescript", "typescript-operations", "typescript-graphql-request"],
plugins: [
{
add: {
content: 'export * from "./schema";',
placement: "append",
},
},
"typescript-operations",
"typescript-graphql-request",
],
config: {
defaultScalarType: "any",
importSchemaTypesFrom: "./src/generated/schema",
namespacedImportName: "Types",
},
},
},
// The lint command does not expect any additional arguments, so we pass # to ignore them
hooks: { afterAllFileWrite: ["ray lint --fix #"] },
hooks: { afterAllFileWrite: ["prettier --write ./src/generated/schema.ts ./src/generated/graphql.ts"] },
};

export default config;
15 changes: 1 addition & 14 deletions extensions/github/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions extensions/github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@
"yauzl": "^3.2.0"
},
"devDependencies": {
"@graphql-codegen/add": "^7.0.0",
Comment thread
TyceHerrman marked this conversation as resolved.
"@graphql-codegen/cli": "^7.0.0",
"@graphql-codegen/typescript": "^6.0.1",
"@graphql-codegen/typescript-graphql-request": "^7.0.1",
Expand All @@ -1142,7 +1143,6 @@
"@types/react": "^19.0.10",
"@types/yauzl": "^2.10.3",
"concurrently": "^8.2.2",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"graphql": "^16.8.2",
Expand All @@ -1156,7 +1156,8 @@
"fix-lint": "ray lint --fix",
"lint": "ray lint",
"publish": "npx @raycast/api@latest publish",
"generate": "graphql-codegen --config codegen.ts"
"generate": "graphql-codegen --config codegen.ts",
"update-schema": "node scripts/update-graphql-schema.mjs"
},
"platforms": [
"macOS",
Expand Down
Loading
Loading