更新目录结构和提交历史 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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 "" >> README.md | |
echo "\`\`\`" >> README.md | |
tree -L 2 -I '.git|.github|node_modules' --charset=ascii >> README.md | |
echo "\`\`\`" >> README.md | |
- name: Commit and Push | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add README.md | |
git diff --quiet && git diff --staged --quiet || git commit -m "docs: update directory tree" | |
git push |