Add GraphQL Generation Check to CI Workflow (#9742)
This pull request addresses the issue of ensuring that npx nx run twenty-front:graphql:generate and npx nx run twenty-front:graphql:generate --configuration=metadata commands are run to generate the necessary GraphQL files. This prevents changes from being missed and ending up in subsequent unrelated PRs. Changes: Added a step in the ci-server.yml workflow to check for pending GraphQL generation. If any GraphQL changes are detected, the CI will fail, and an error message will be displayed instructing the developer to run the necessary commands and commit the changes. This approach is similar to the existing TypeORM migration check and helps maintain consistency and correctness in the codebase. Issue Resolved: #9726 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
13
.github/workflows/ci-server.yaml
vendored
13
.github/workflows/ci-server.yaml
vendored
@ -97,6 +97,19 @@ jobs:
|
||||
|
||||
exit 1
|
||||
fi
|
||||
- name: GraphQL / Check for Pending Generation
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
GRAPHQL_GENERATE_OUTPUT=$(npx nx run twenty-front:graphql:generate || true)
|
||||
GRAPHQL_METADATA_OUTPUT=$(npx nx run twenty-front:graphql:generate --configuration=metadata || true)
|
||||
if [[ $GRAPHQL_GENERATE_OUTPUT == *"No changes detected"* && $GRAPHQL_METADATA_OUTPUT == *"No changes detected"* ]]; then
|
||||
echo "GraphQL generation check passed."
|
||||
else
|
||||
echo "::error::Unexpected GraphQL changes detected. Please run the required commands and commit the changes."
|
||||
echo "$GRAPHQL_GENERATE_OUTPUT"
|
||||
echo "$GRAPHQL_METADATA_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
- name: Save server setup
|
||||
uses: ./.github/workflows/actions/save-cache
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user