Skip to content

更新目录结构和提交历史 #6

更新目录结构和提交历史

更新目录结构和提交历史 #6

name: Update Directory Tree
on:
schedule:
- cron: '0 0 * * *' # 每天 UTC 00:00 运行
workflow_dispatch: # 允许手动触发
jobs:
update-directory-tree:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Install tree
run: sudo apt-get install -y tree
- name: Create Directory Tree
run: |
echo "# Personal Notes" > README.md
echo "" >> README.md
echo "## Directory Structure" >> README.md
echo "Last updated: $(date '+%Y-%m-%d %H:%M:%S %Z')" >> README.md
echo "" >> README.md
echo "\`\`\`" >> README.md
tree -L 2 -I '.git|.github|node_modules' --charset=ascii >> README.md
echo "\`\`\`" >> README.md
- name: Create Branch and Push Changes
run: |
# 创建新的分支
git checkout -b directory-tree-updates-$(date +%Y%m%d)
# 提交更改
git add README.md
git commit -m "docs: update directory tree"
# 推送到远程
git push origin HEAD