Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[core] GraphQL: Skip prompts in non-interactive/CI environment #2277

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Feb 2, 2021

Type of change (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or update to documentation)
  • Maintenance
  • Other, please describe:

Does this change require a documentation update? (Check one)

  • Yes
  • No

Current behavior

When you run sanity graphql deploy in a CI or non-interactive prompt (eg sanity graphql deploy | grep foo), it will stall because of prompts waiting for an answer (do you want a playground? do you want to proceed despite dangerous changes?).

Description

This PR checks for CI/non-interactive environments and skips the prompts if true:

  • The playground prompt defaults to the current state (if there is one currently deployed) and falls back to true otherwise
  • Mismatch in GraphQL generation throws an error (unless --force)
  • Dangerous/breaking changes throws an error (unless --force)

There's a slight change in behavior for interactive environments, too: for the playground prompt, it defaults to the current value. I think that's better than explicitly having to answer "no" each time you deploy.

Note for release

  • Skip prompts on sanity graphql deploy in non-interactive environments

Checklist

  • I have read the Contributing Guidelines
  • The PR title includes a link to the relevant issue
  • The PR title is appropriately formatted: [some-package] PR title (#123)
  • The code is linted
  • The test suite is passing
  • Corresponding changes to the documentation have been made

@rexxars rexxars requested a review from saasen February 2, 2021 01:10
@vercel
Copy link

vercel bot commented Feb 2, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/7a9v7z00r/sanity.build
✅ Preview: https://test-studio-git-gql-ci-flag.sanity.build

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/b92jgbl6k/sanity.build
✅ Preview: https://perf-studio-git-gql-ci-flag.sanity.build

Copy link
Contributor

@saasen saasen left a comment

Choose a reason for hiding this comment

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

LGTM!

@rexxars rexxars merged commit 1d7c63e into next Feb 2, 2021
@rexxars rexxars deleted the gql-ci-flag branch February 2, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants