From bf0ac0a244fe28d07eaef152b8f7459b7a79e39b Mon Sep 17 00:00:00 2001 From: yinkanglong Date: Sun, 21 Jan 2024 20:09:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=8D=9A=E5=AE=A2=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=B5=81=E6=B0=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/call_remote_api.yml | 6 ++++-- blog/docsify/build_sidebar.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/call_remote_api.yml b/.github/workflows/call_remote_api.yml index 5b32d5f0..e1ee76b8 100644 --- a/.github/workflows/call_remote_api.yml +++ b/.github/workflows/call_remote_api.yml @@ -22,7 +22,9 @@ jobs: # pip install -r requirements.txt # 如果有依赖,请替换为实际的依赖安装命令 - name: Generate files with Python script - run: python ./notes/blog/docsify/build_sidebar.py # 替换为你的Python脚本路径 + run: | + root_dir = $(pwd) + python ./blog/docsify/build_sidebar.py root_dir # 替换为你的Python脚本路径 - name: Commit generated files run: | @@ -36,7 +38,7 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: main - + - name: Call Remote API run: | curl -X GET http://8.141.4.34/#/ diff --git a/blog/docsify/build_sidebar.py b/blog/docsify/build_sidebar.py index c4299cfa..13cd6bfd 100644 --- a/blog/docsify/build_sidebar.py +++ b/blog/docsify/build_sidebar.py @@ -2,8 +2,10 @@ from configparser import ConfigParser from os.path import splitext, basename, join, isdir, relpath, abspath from os import listdir import os +import sys # docsify根目录 +# root_dir='/root/gitee/notes' root_dir='/root/gitee/notes' # 要处理的文件或文件夹 exclude_start_with=['_','*','.'] @@ -172,4 +174,7 @@ if __name__ == "__main__": 第n-1层会生成n层目录的_sidebar 第n层生成之后所有目录的_sidebar ''' + if len(sys.argv) > 1: + root_dir = sys.argv[1] + print("root_dir is:", root_dir) layer_traverse(root_dir,0,create_depth)