mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-01 17:50:50 +08:00
fix(core): copilot test condition & retry (#8665)
This commit is contained in:
@@ -473,12 +473,8 @@ jobs:
|
||||
env:
|
||||
BASE_REF: ${{ github.base_ref }}
|
||||
run: |
|
||||
if [ -n "$BASE_REF" ]; then
|
||||
if node ./scripts/detect-blocksuite-update.mjs "$BASE_REF"; then
|
||||
echo "skip=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "skip=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
if node ./scripts/detect-blocksuite-update.mjs "$BASE_REF"; then
|
||||
echo "skip=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "skip=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
@@ -65,13 +65,13 @@ async function findPackageJson(root) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
if (process.argv.length < 3) {
|
||||
console.error('Usage: node script.js <commit-hash>');
|
||||
const commitHash = process.argv[2] || process.env.GITHUB_BASE_REF;
|
||||
const currentHead = process.argv[3] || 'HEAD';
|
||||
if (!commitHash) {
|
||||
console.error('Missing base ref commit hash, skipping check.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const commitHash = process.argv[2];
|
||||
const currentHead = process.argv[3] || 'HEAD';
|
||||
const changedPackages = new Set();
|
||||
const folders = await findPackageJson(
|
||||
join(fileURLToPath(import.meta.url), '..', '..')
|
||||
|
||||
@@ -113,15 +113,22 @@ const focusToEditor = async (page: Page) => {
|
||||
};
|
||||
|
||||
const getEditorContent = async (page: Page) => {
|
||||
const lines = await page.$$('page-editor .inline-editor');
|
||||
const contents = await Promise.all(lines.map(el => el.innerText()));
|
||||
return (
|
||||
contents
|
||||
let content = '';
|
||||
let retry = 3;
|
||||
while (!content && retry > 0) {
|
||||
const lines = await page.$$('page-editor .inline-editor');
|
||||
const contents = await Promise.all(lines.map(el => el.innerText()));
|
||||
content = contents
|
||||
// cleanup zero width space
|
||||
.map(c => c.replace(/\u200B/g, '').trim())
|
||||
.filter(c => !!c)
|
||||
.join('\n')
|
||||
);
|
||||
.join('\n');
|
||||
if (!content) {
|
||||
await page.waitForTimeout(500);
|
||||
retry -= 1;
|
||||
}
|
||||
}
|
||||
return content;
|
||||
};
|
||||
|
||||
const switchToEdgelessMode = async (page: Page) => {
|
||||
|
||||
Reference in New Issue
Block a user