Improved Schema Checks in GitHub Merge Queues

Laurin Quast
Laurin Quast

Hive Console now supports reliable schema checks for repositories that use GitHub Merge Queue.

Merge queues test groups of pull requests together. A check for the second pull request in a group, for example, also includes the changes from the first pull request. Comparing that accumulated schema directly with the latest schema in the registry can report a breaking change that was introduced and approved in an earlier pull request for a second time.

Compare the merge queue entry

The Hive CLI's new --baseline option accepts a base schema as either a local file or a file from Git history using <revision>:<path>. Hive composes that base version and the proposed version with the other services in the registry, then compares the resulting schemas. The check therefore evaluates only the changes introduced between the merge group's base and head commits. This option is available in the latest Hive CLI release, version 0.62.0.

hive schema:check "services/products/schema.graphql" \
  --service products \
  --target "the-guild/hive-console/development" \
  --baseline "$MERGE_GROUP_BASE_SHA:services/products/schema.graphql"

Composition errors and newly applicable conditional breaking changes are still detected in the accumulated merge group. For Federation projects, contract checks also use the composed base schema. When you use --github, the CLI automatically associates the check and any breaking-change approvals with the pull request at the head of the merge group.

When using the Git revision syntax, --baseline requires one schema file path and your CI checkout must contain the referenced commit in its Git history.