Skip to content

Commit

Permalink
GitHub action: Enable diffing of endpoint with local json schema (#2090)
Browse files Browse the repository at this point in the history
Co-authored-by: Kamil Kisiela <[email protected]>
  • Loading branch information
ManBearTM and kamilkisiela authored Jul 6, 2022
1 parent 2c952cc commit 8fffe1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion action/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/action/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
printSchemaFromEndpoint,
produceSchema,
} from '@graphql-inspector/github';
import { Source, GraphQLSchema, buildClientSchema, printSchema } from 'graphql';
import { Source, GraphQLSchema, buildClientSchema, buildSchema, printSchema } from 'graphql';
import { readFileSync } from 'fs';
import { resolve, extname } from 'path';
import { execSync } from 'child_process';
Expand Down Expand Up @@ -141,8 +141,8 @@ export async function run() {
let newSchema: GraphQLSchema;
let sources: { new: Source; old: Source };

if (extname(schemaPath.toLowerCase()) === '.json') {
oldSchema = buildClientSchema(JSON.parse(oldFile));
if (extname(schemaPath.toLowerCase()) === ".json") {
oldSchema = endpoint ? buildSchema(oldFile) : buildClientSchema(JSON.parse(oldFile));
newSchema = buildClientSchema(JSON.parse(newFile));

sources = {
Expand Down

1 comment on commit 8fffe1c

@vercel
Copy link

@vercel vercel bot commented on 8fffe1c Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.