Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: copilot ci condition (#8692)

darkskygit89d09fd5e9fd
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 7539c0cac2..de078dd45b 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -408,22 +408,44 @@ jobs:
steps:
- uses: actions/checkout@v4
+ - name: Check blocksuite update
+ id: check-blocksuite-update
+ env:
+ BASE_REF: ${{ github.base_ref }}
+ run: |
+ if node ./scripts/detect-blocksuite-update.mjs "$BASE_REF"; then
+ echo "skip=false" >> $GITHUB_OUTPUT
+ else
+ echo "skip=true" >> $GITHUB_OUTPUT
+ fi
+
+ - uses: dorny/paths-filter@v3
+ id: filter
+ with:
+ filters: |
+ backend:
+ - 'packages/backend/server/src/**'
+
- name: Setup Node.js
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
uses: ./.github/actions/setup-node
with:
electron-install: false
full-cache: true
- name: Download server-native.node
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
uses: actions/download-artifact@v4
with:
name: server-native.node
path: ./packages/backend/server
- name: Prepare Server Test Environment
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
uses: ./.github/actions/server-test-env
- name: Run server tests
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
run: yarn workspace @affine/server test:copilot:coverage --forbid-only
env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
@@ -431,6 +453,7 @@ jobs:
COPILOT_FAL_API_KEY: ${{ secrets.COPILOT_FAL_API_KEY }}
- name: Upload server test coverage results
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
@@ -480,7 +503,7 @@ jobs:
fi
- name: Setup Node.js
- if: ${{ steps.check-blocksuite-update.outputs.skip == 'true' }}
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' }}
uses: ./.github/actions/setup-node
with:
playwright-install: true
@@ -488,14 +511,14 @@ jobs:
hard-link-nm: false
- name: Download server-native.node
- if: ${{ steps.check-blocksuite-update.outputs.skip == 'true' }}
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' }}
uses: actions/download-artifact@v4
with:
name: server-native.node
path: ./packages/backend/server
- name: Run Copilot E2E Test ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- if: ${{ steps.check-blocksuite-update.outputs.skip == 'true' }}
+ if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' }}
uses: ./.github/actions/copilot-test
with:
script: yarn workspace @affine-test/affine-cloud-copilot e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
diff --git a/scripts/detect-blocksuite-update.mjs b/scripts/detect-blocksuite-update.mjs
index be9ecc68cb..b6af17118a 100644
--- a/scripts/detect-blocksuite-update.mjs
+++ b/scripts/detect-blocksuite-update.mjs
@@ -95,10 +95,10 @@ async function main() {
if (changedPackages.size > 0) {
console.log('Blocksuite packages have been updated.', changedPackages);
- process.exit(1);
+ process.exit(0);
} else {
console.log('No changes to Blocksuite packages.');
- process.exit(0);
+ process.exit(1);
}
}