Skip to content

Commit 352c1c5

Browse files
authored
Add GitHub Actions workflow to generate directory tree
This workflow generates a directory tree and updates the README with the output.
1 parent e16b210 commit 352c1c5

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Generate Directory Tree
2+
3+
on:
4+
push:
5+
paths:
6+
- '**' # 任何文件变动都触发
7+
- '!README.md' # 忽略 README 本身的变动,防止死循环
8+
branches:
9+
- main # 或者 master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Generate Tree
18+
run: |
19+
# 安装 tree
20+
sudo apt-get install -y tree
21+
# 生成目录结构 (排除 .git 等杂项)
22+
tree -a -I '.git|__pycache__|.github|*.egg-info' --dirsfirst > tree.txt
23+
24+
- name: Update README
25+
uses: x-access-token/readmes-updater@v1
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
file: 'README.md'
29+
content-file: 'tree.txt'
30+
start-tag: '<!-- START_SECTION:tree -->'
31+
end-tag: '<!-- END_SECTION:tree -->'

0 commit comments

Comments
 (0)