Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions .github/workflows/tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,33 @@ jobs:
run: pnpm graphql-codegen
- name: Run git diff
run: git diff
- name: Fail if any changes were made
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm graphql-codegen when queries are changed, committing any fixes and generated files" ; exit 1; }'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we don't need to check this on Github anymore, this should only happen in World.

Once code reaches CLI; it doesn't matter if the schemas change as it is 100% unrelated to the mirrored code (otherwise it couldn't have been merged in World)

# The schemas come from the servers' latest code, so the generated files can differ on a pull request
# that doesn't touch GraphQL. bin/graphql-codegen/check-drift.js fails only on differences the pull
# request or merge group could have caused, and warns about the rest. A mirror pull request brings
# changes that the upstream repository's CI has already checked, so a difference there comes from a
# schema change made since, and the upstream repository regenerates the files.
- name: Fail if the change left the generated files out of date
env:
MIRROR_PULL_REQUEST: ${{ github.event.pull_request.head.ref == 'world-mirror/main' && github.event.pull_request.head.repo.full_name == github.repository }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "The generated GraphQL files are up to date."
elif [ "$MIRROR_PULL_REQUEST" = true ]; then
echo "::warning title=Generated GraphQL files are out of date::The upstream repository's CI has already checked this mirror pull request, so a schema change made since caused the difference."
git status --porcelain
else
changed_files="$RUNNER_TEMP/changed-files.txt"
if [ -n "$MERGE_GROUP_BASE_SHA" ]; then
git fetch --no-tags --depth=1 origin "$MERGE_GROUP_BASE_SHA"
git diff --name-only "$MERGE_GROUP_BASE_SHA" HEAD > "$changed_files"
else
gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PULL_REQUEST_NUMBER/files" \
--jq '.[] | .filename, (.previous_filename // empty)' > "$changed_files"
fi
node bin/graphql-codegen/check-drift.js --changed-files "$changed_files"
fi

oclif-checks:
name: 'Check OCLIF manifests & readme & docs'
Expand Down
Loading