更新目录结构和提交历史 #4
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 | |
pull-requests: 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: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "docs: update directory tree" | |
title: "docs: update directory tree" | |
body: | | |
Automatically update directory tree in README.md | |
This PR was automatically created by the GitHub Action workflow. | |
branch: update-directory-tree | |
delete-branch: true | |
base: master |