This is an automated email from the ASF dual-hosted git repository.

bzp2010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 706c4adffe7 fix: ignore docs submodule (#1385)
706c4adffe7 is described below

commit 706c4adffe7ffd3ac01494da674cd289d17c9316
Author: Young <isk...@outlook.com>
AuthorDate: Mon Oct 31 09:12:25 2022 +0800

    fix: ignore docs submodule (#1385)
---
 .github/workflows/deploy.yml | 12 ++++++------
 scripts/sync-docs.js         | 28 ++++++++++++++++++----------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index ac493853e75..4aa4e5d9a46 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -11,7 +11,7 @@ on:
     branches: [master]
   schedule:
     # Run everyday at 9:00 AM (See 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
-    - cron: "0 5 * * *"
+    - cron: '0 5 * * *'
 
 # A workflow run is made up of one or more jobs that can run sequentially or 
in parallel
 jobs:
@@ -29,7 +29,7 @@ jobs:
 
       - uses: actions/setup-node@v3
         with:
-          node-version: "16"
+          node-version: '16'
 
       - name: Get node version
         id: node-version
@@ -73,9 +73,9 @@ jobs:
         with:
           path: |
             ./scripts/temp
-          key: ${{ runner.os }}-dep-${{ steps.node-version.outputs.ver 
}}-docs-${{ hashFiles('website/config/apisix-versions.js') }}-${{ 
steps.get-date.outputs.date }}
+          key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-docs-${{ 
hashFiles('website/config/apisix-versions.js') }}-${{ 
steps.get-date.outputs.date }}
           restore-keys: |
-            ${{ runner.os }}-dep-${{ steps.node-version.outputs.ver 
}}-docs-${{ hashFiles('website/config/apisix-versions.js') }}
+            ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-docs-${{ 
hashFiles('website/config/apisix-versions.js') }}
 
       - name: Sync documents
         run: |
@@ -112,9 +112,9 @@ jobs:
         uses: ./.github/actions/actions-netlify
         if: ${{ false }}
         with:
-          publish-dir: "./website/build"
+          publish-dir: './website/build'
           github-token: ${{ secrets.GITHUB_TOKEN }}
-          deploy-message: "${{ github.event.pull_request.title }}, Deploy from 
GitHub Actions"
+          deploy-message: '${{ github.event.pull_request.title }}, Deploy from 
GitHub Actions'
           enable-pull-request-comment: true
           enable-commit-comment: true
           overwrites-pull-request-comment: true
diff --git a/scripts/sync-docs.js b/scripts/sync-docs.js
index d5fc18aa00f..f00239dbc9b 100644
--- a/scripts/sync-docs.js
+++ b/scripts/sync-docs.js
@@ -33,23 +33,27 @@ const tasks = new Listr([
       const gitTasks = projects.map((project) => ({
         title: `Clone ${project.name} repository`,
         task: async () => {
-          const dir = `${tempPath}/${project.name}/`;
+          const { name } = project;
+          const dir = `${tempPath}/${name}/`;
           const exist = await isDirExisted(dir);
           if (exist) {
-            gitMap[project.name] = simpleGit(dir);
-            await gitMap[project.name].cwd(dir).fetch();
+            gitMap[name] = simpleGit(dir);
+            await gitMap[name]
+              .cwd(dir)
+              .fetch(['--prune', '--filter=blob:none', 
'--recurse-submodules=no']);
           } else {
-            gitMap[project.name] = simpleGit();
-            await gitMap[project.name]
-              .clone(`https://github.com/apache/${project.name}.git`, dir, {
+            gitMap[name] = simpleGit();
+            await gitMap[name]
+              .clone(`https://github.com/apache/${name}.git`, dir, {
                 '--filter': 'blob:none',
                 '--sparse': true,
+                '--recurse-submodules': 'no',
               })
               .cwd(dir)
               .raw(['sparse-checkout', 'set', 'docs']);
 
-            if (project.name === 'apisix') {
-              await gitMap[project.name]
+            if (name === 'apisix') {
+              await gitMap[name]
                 .cwd(dir)
                 .raw(['sparse-checkout', 'add', 'apisix/core', 'autodocs']);
             }
@@ -72,7 +76,8 @@ const tasks = new Listr([
               const isIngressController = project.name === 
'apisix-ingress-controller';
               projectReleases[project.name] = ret.all
                 .filter((release) => (isIngressController
-                  ? release.includes('remotes/origin/v') && 
semver.gt(release.replace('remotes/origin/v', ''), '0.3.0')
+                  ? release.includes('remotes/origin/v')
+                      && semver.gt(release.replace('remotes/origin/v', ''), 
'0.3.0')
                   : release.includes('remotes/origin/release/')))
                 .map((release) => (isIngressController
                   ? release.replace('remotes/origin/v', '')
@@ -94,7 +99,10 @@ const tasks = new Listr([
         if (versions.length === 0) return Promise.resolve();
 
         if (await isFileExisted(target)) await fs.rm(target);
-        return fs.writeFile(target, JSON.stringify(versions.map((v) => 
versionMap[v] || v).reverse(), null, 2));
+        return fs.writeFile(
+          target,
+          JSON.stringify(versions.map((v) => versionMap[v] || v).reverse(), 
null, 2),
+        );
       };
 
       const extractTasks = projectPaths.map((project) => ({

Reply via email to