Skip to content

ci: add opt-in dataset schema sync check to PR workflow#36

Draft
Matej Jurčák (JMatej) wants to merge 1 commit intomasterfrom
claude/ci-schema-type-sync-v1I8d
Draft

ci: add opt-in dataset schema sync check to PR workflow#36
Matej Jurčák (JMatej) wants to merge 1 commit intomasterfrom
claude/ci-schema-type-sync-v1I8d

Conversation

@JMatej
Copy link
Copy Markdown

Summary

Today the only thing guarding against the dataset schema (*/dataset_schema.json) drifting out of sync with the TS dataset-item types is the husky pre-commit hook in apify-store/booking (npm run dataset-schema:check). That hook can be bypassed (--no-verify) or simply not installed, so an out-of-sync schema can land on master without CI noticing.

This PR adds a new Dataset Schema Sync Check step to the unitTest job in the reusable pr-build-test.yaml workflow. To stay safe for the other repos that consume this workflow but don't have a dataset schema script, the step is opt-in by presence: it runs npm run dataset-schema:check only when that script is defined in the consumer's package.json, otherwise it logs a skip message and exits 0.

This matches the pattern already used in this file for build-check, prettier, and knip / ts-unused-exports.

How to enroll a repo

No workflow change needed — just define the script in the consumer's package.json:

"scripts": {
  "dataset-schema:check": "tsx ./scripts/dataset-schema.ts check"
}

apify-store/booking already has this script, so it will start enforcing on the next PR after this merges.

Test plan

  • Open a PR in apify-store/booking with a deliberately out-of-sync dataset_schema.json and confirm the new step fails the unitTest job.
  • Open a PR in a repo that does not define dataset-schema:check (e.g. another consumer of this reusable workflow) and confirm the step logs the skip message and the job stays green.
  • Open a PR in apify-store/booking where the schema is in sync and confirm the step passes.

Drafted while paired with Claude — leaving as draft until the test plan above is exercised.


Generated by Claude Code

Adds a Dataset Schema Sync Check step to the unitTest job that runs
`npm run dataset-schema:check` only when the script is defined in the
repo's package.json. Repos without the script silently skip the step,
matching the opt-in-by-presence pattern already used for build-check,
prettier, and knip/ts-unused-exports.
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.

1 participant