From 8880cef20b9c2e4087ae397916c4381ea1bacbb5 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Fri, 14 Mar 2025 02:58:27 +0000 Subject: [PATCH] test(infra): add check job to verify committed changes (#10829) --- .github/workflows/build-test.yml | 26 +++++++++++++++++++ .prettierignore | 1 + oxlint.json | 1 + .../frontend/graphql/src/graphql/index.ts | 17 +++--------- packages/frontend/graphql/src/schema.ts | 1 + packages/frontend/i18n/src/i18n.gen.ts | 4 +++ packages/frontend/i18n/src/resources/en.json | 1 + 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5c28d3bf68..31c46c6ab5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -138,6 +138,31 @@ jobs: rustup component add clippy cargo clippy --all-targets --all-features -- -D warnings + check-git-status: + name: Check Git Status + runs-on: ubuntu-latest + needs: + - optimize_ci + if: needs.optimize_ci.outputs.skip == 'false' + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + full-cache: true + + - name: Run Check + run: | + yarn affine init + yarn affine gql build + yarn affine i18n build + git status --porcelain | grep . && { + echo "Run 'yarn affine init && yarn affine gql build && yarn affine i18n build' and make sure all changes are submitted" + exit 1 + } || { + echo "All changes are submitted" + } + check-yarn-binary: name: Check yarn binary runs-on: ubuntu-latest @@ -915,6 +940,7 @@ jobs: - analyze - lint - lint-rust + - check-git-status - check-yarn-binary - e2e-test - e2e-legacy-blocksuite-test diff --git a/.prettierignore b/.prettierignore index 02c2a1c0e8..a90e4e390e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -24,6 +24,7 @@ test-results **/*.gen.ts **/*.gql **/*.d.ts +packages/frontend/graphql/src/graphql/index.ts # per files tools/cli/src/webpack/error-handler.js diff --git a/oxlint.json b/oxlint.json index fde3616552..0dfa95aed7 100644 --- a/oxlint.json +++ b/oxlint.json @@ -27,6 +27,7 @@ "**/*.gen.ts", "**/*.gql", "**/*.d.ts", + "packages/frontend/graphql/src/graphql/index.ts", "tools/cli/src/webpack/error-handler.js", "packages/backend/native/index.d.ts", "packages/backend/server/src/__tests__/__snapshots__", diff --git a/packages/frontend/graphql/src/graphql/index.ts b/packages/frontend/graphql/src/graphql/index.ts index cf5937b9c7..cbd980714d 100644 --- a/packages/frontend/graphql/src/graphql/index.ts +++ b/packages/frontend/graphql/src/graphql/index.ts @@ -639,9 +639,7 @@ export const getCurrentUserQuery = { } } }`, - deprecations: [ - "'token' is deprecated: use [/api/auth/sign-in?native=true] instead", - ], + deprecations: ["'token' is deprecated: use [/api/auth/sign-in?native=true] instead"], }; export const getDocDefaultRoleQuery = { @@ -893,10 +891,7 @@ export const getWorkspaceInfoQuery = { team } }`, - deprecations: [ - "'isAdmin' is deprecated: use WorkspaceType[role] instead", - "'isOwner' is deprecated: use WorkspaceType[role] instead", - ], + deprecations: ["'isAdmin' is deprecated: use WorkspaceType[role] instead","'isOwner' is deprecated: use WorkspaceType[role] instead"], }; export const getWorkspacePageByIdQuery = { @@ -1195,9 +1190,7 @@ export const quotaQuery = { } } }`, - deprecations: [ - "'storageQuota' is deprecated: use `UserQuotaType['usedStorageQuota']` instead", - ], + deprecations: ["'storageQuota' is deprecated: use `UserQuotaType['usedStorageQuota']` instead"], }; export const readNotificationMutation = { @@ -1644,9 +1637,7 @@ export const getWorkspaceRolePermissionsQuery = { } } }`, - deprecations: [ - "'workspaceRolePermissions' is deprecated: use WorkspaceType[permissions] instead", - ], + deprecations: ["'workspaceRolePermissions' is deprecated: use WorkspaceType[permissions] instead"], }; export const approveWorkspaceTeamMemberMutation = { diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.ts index d03d04881b..562acbf1ac 100644 --- a/packages/frontend/graphql/src/schema.ts +++ b/packages/frontend/graphql/src/schema.ts @@ -155,6 +155,7 @@ export interface CopilotContext { export interface CopilotContextMatchContextArgs { content: Scalars['String']['input']; limit?: InputMaybe; + threshold?: InputMaybe; } export interface CopilotContextMatchWorkspaceContextArgs { diff --git a/packages/frontend/i18n/src/i18n.gen.ts b/packages/frontend/i18n/src/i18n.gen.ts index 5f39e13d2a..4740bd9eed 100644 --- a/packages/frontend/i18n/src/i18n.gen.ts +++ b/packages/frontend/i18n/src/i18n.gen.ts @@ -7577,6 +7577,10 @@ export function useAFFiNEI18N(): { contextId: string; message: string; }>): string; + /** + * `Embedding feature not available, you may need to install pgvector extension to your database` + */ + ["error.COPILOT_EMBEDDING_UNAVAILABLE"](): string; /** * `You have exceeded your blob storage quota.` */ diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 7ccb47e13d..3e8c6fe83d 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -1863,6 +1863,7 @@ "error.COPILOT_CONTEXT_FILE_NOT_SUPPORTED": "File {{fileName}} is not supported to use as context: {{message}}", "error.COPILOT_FAILED_TO_MODIFY_CONTEXT": "Failed to modify context {{contextId}}: {{message}}", "error.COPILOT_FAILED_TO_MATCH_CONTEXT": "Failed to match context {{contextId}} with \"%7B%7Bcontent%7D%7D\": {{message}}", + "error.COPILOT_EMBEDDING_UNAVAILABLE": "Embedding feature not available, you may need to install pgvector extension to your database", "error.BLOB_QUOTA_EXCEEDED": "You have exceeded your blob storage quota.", "error.MEMBER_QUOTA_EXCEEDED": "You have exceeded your workspace member quota.", "error.COPILOT_QUOTA_EXCEEDED": "You have reached the limit of actions in this workspace, please upgrade your plan.",