Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to use GraphQL endpoint with Github Actions? #549

Closed
georgeboot opened this issue Aug 20, 2019 · 7 comments
Closed

How to use GraphQL endpoint with Github Actions? #549

georgeboot opened this issue Aug 20, 2019 · 7 comments
Milestone

Comments

@georgeboot
Copy link

georgeboot commented Aug 20, 2019

I am trying to configure a github action, but I'm not winning.

Previously, we ran the cli version of this package in CLI like so:

# write new schema to .gql file
php artisan lighthouse:print > schema.gql

yarn install

# compare with live version
npx graphql-inspector diff https://api.company.com/graphql schema.gql

That worked fine.

What I'm now trying, using Actions, is the following:

# .github/workflows/main.yml

name: CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v1
    
    - name: Check GraphQL with Inspector
      uses: kamilkisiela/graphql-inspector@v1.23.1

My config file:

# .github/graphql-inspector.yaml

diff: true
schema:
  ref: master
  path: https://api.company.com/graphql

However, this fails every time I try, with the following output:

Run kamilkisiela/graphql-inspector@v1.23.1
/usr/bin/docker run --name fe0f0c71fe765c444dc8bf12b9e05e2cd14c_d74472 --label 29fe0f --workdir /github/workspace --rm -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/repo/repo":"/github/workspace" 29fe0f:0c71fe765c444dc8bf12b9e05e2cd14c
ℹ  info      GraphQL Inspector started
ℹ  info      Failed to find .github/graphql-inspector.yaml file
ℹ  info      Failed to find .github/graphql-inspector.yml file
✖  fatal     No config file
✖  fatal     Failed to find any config file
##[error]Docker run failed with exit code 1

What am I doing wrong?

@kamilkisiela
Copy link
Owner

It doesn't support graphql endpoints, only files. I will try to implement it today.

@kamilkisiela kamilkisiela added the 🐞 bug Something isn't working label Sep 3, 2019
@kamilkisiela
Copy link
Owner

Why do you want to compare it against a deployed GraphQL endpoint and not the master branch?

@kamilkisiela kamilkisiela removed the 🐞 bug Something isn't working label Sep 3, 2019
@kamilkisiela kamilkisiela changed the title How to configure with Github Actions? How to use GraphQL endpoint with Github Actions? Sep 3, 2019
@georgeboot
Copy link
Author

Well, technically I could also checkout master branch in a PR and generate the .graphql file from there. It's just easier to grab it from the live version as that is for sure whats out there currently. Master technically doesn't have to be deployed.

Note that the error message I'm getting states that the config file could not be found. Or this error message is very misleading, or (more likely) there is more that needs to be fixed than implementing endpoint comparisons.

@georgeboot
Copy link
Author

@kamilkisiela any clue why it says it can't find my config file?

@kamilkisiela
Copy link
Owner

it will be possible with in next version
#1425

@kamilkisiela kamilkisiela added the ⏳ waiting for release This issue or pull request is waiting to be released label Apr 18, 2020
@kamilkisiela
Copy link
Owner

v2.0.0 released. Read more about new GraphQL Inspector

@kamilkisiela kamilkisiela removed the ⏳ waiting for release This issue or pull request is waiting to be released label May 11, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@georgeboot @kamilkisiela and others