Don't hit GitHub API for schema comparisons - #933
Draft
blampe wants to merge 3 commits into
Draft
Conversation
danielrbradley
left a comment
Contributor
There was a problem hiding this comment.
As of recently, we've stopped checking out the entire repository as this is a slow operation for some providers to do in every step. We need to ensure this change works with a shallow clone as downloading the whole git history is slower than fetching the single file.
| if: "github.event_name == 'pull_request'", | ||
| name: "Check Schema is Valid", | ||
| run: | ||
| "git show ${{ github.event.repository.default_branch }}:provider/cmd/pulumi-resource-${{ env.PROVIDER }}/schema.json > ${{ runner.temp }}/schema.json;\n" + |
Contributor
There was a problem hiding this comment.
Will this work when we only have a shallow clone of the repository? Does the shallow clone include the default_branch?
danielrbradley
suggested changes
May 17, 2024
danielrbradley
left a comment
Contributor
There was a problem hiding this comment.
As an alternative, I'd suggest adding the complexity to the schema-tools to check if the base is available in git directly, then falling back to the github API if it's a shallow clone.
blampe
marked this pull request as draft
June 20, 2024 20:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We don't need to query the GitHub API for the original schema because we already have it in git history.
The latest
schema-toolssupports reading from disk instead of fetching from GitHub. This changes the job to drop the original schema into a temporary location and use that for comparison.actions/checkoutgives us a shallow merge commit. To compute the original schema, we usegit apply --reverseto construct the schema as it existed before our merge.Requires a schema-tools release to work.
Fixes pulumi/schema-tools#64.