{"id":28252806,"url":"https://github.com/ravelloh/readme-tree","last_synced_at":"2025-07-20T14:04:24.526Z","repository":{"id":52889163,"uuid":"521106177","full_name":"RavelloH/readme-tree","owner":"RavelloH","description":"Use github actions to automatically add a tree view of the repo for readme documents when commit. # # # 使用GithubActions在提交时自动为Readme文档添加树状文件图 ","archived":false,"fork":false,"pushed_at":"2022-08-11T03:15:50.000Z","size":94,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-15T22:38:59.127Z","etag":null,"topics":["actions","github-actions","marketplace","profile","python","readme","readme-profile","shell","tree","tree-structure"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RavelloH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-04T03:11:20.000Z","updated_at":"2024-11-28T11:14:02.000Z","dependencies_parsed_at":"2022-08-26T12:51:09.819Z","dependency_job_id":null,"html_url":"https://github.com/RavelloH/readme-tree","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/RavelloH/readme-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RavelloH%2Freadme-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RavelloH%2Freadme-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RavelloH%2Freadme-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RavelloH%2Freadme-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RavelloH","download_url":"https://codeload.github.com/RavelloH/readme-tree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RavelloH%2Freadme-tree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266135685,"owners_count":23881803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","github-actions","marketplace","profile","python","readme","readme-profile","shell","tree","tree-structure"],"created_at":"2025-05-19T16:16:42.858Z","updated_at":"2025-07-20T14:04:24.520Z","avatar_url":"https://github.com/RavelloH.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# readme-tree\n\u003cdiv align='center'\u003e  \n\n\u003e **此文档也有[中文版本](#language)**\n\n\u003c/div\u003e\n使用Github Actions在提交时自动为仓库的Readme文档添加树状文件图   \n\nUse GitHub actions to automatically add a tree view for the readme document of the warehouse when submitting\n\n\u003c!-- readme-tree start --\u003e\n```\n.\n├── .github\n│   └── workflows\n│       └── main.yml\n├── LICENCE\n├── README.md\n├── action.yml\n├── main.py\n├── tree.bak\n└── tree.sh\n\n2 directories, 7 files\n```\n\u003c!-- readme-tree end --\u003e\n\n## Language\n\u003cdetails\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e 中文 \u003c/b\u003e \u003c/summary\u003e\n  \n## 效果\n\u003e 注:以下效果可组合使用\n \u003cdetails open\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e 展示/隐藏 \u003c/b\u003e \u003c/summary\u003e\n  \n### 默认\n\n```\n.\n├── .github\n│   └── workflows\n│       └── main.yml\n├── README.md\n├── action.yml\n├── main.py\n└── tree.sh\n\n2 directories, 5 files\n```\n\n### 仅显示仓库文件\n\n```\n.\n├── README.md\n├── action.yml\n├── main.py\n├── tree.bak\n└── tree.sh\n\n0 directories, 5 files\n```\n\n### 仅显示仓库目录\n\n```\n.\n└── .github\n    └── workflows\n    \n2 directories\n```\n\n### 展示文件大小\n\n```\n.\n├── [       4096]  .github\n│   └── [       4096]  workflows\n│       └── [        591]  main.yml\n├── [       1018]  README.md\n├── [       4067]  action.yml\n├── [       1677]  main.py\n├── [          0]  tree.bak\n└── [        809]  tree.sh\n\n2 directories, 6 files\n```\n\n### 展示相对路径\n\n```\n.\n├── ./.github\n│   └── ./.github/workflows\n│       └── ./.github/workflows/main.yml\n├── ./README.md\n├── ./action.yml\n├── ./main.py\n├── ./tree.bak\n└── ./tree.sh\n\n2 directories, 6 files\n```\n\n### 显示git文件\n\n \u003cdetails\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e 展开 \u003c/b\u003e \u003c/summary\u003e\n    \n```\n.\n├── .git\n│   ├── FETCH_HEAD\n│   ├── HEAD\n│   ├── branches\n│   ├── config\n│   ├── description\n│   ├── hooks\n│   │   ├── applypatch-msg.sample\n│   │   ├── commit-msg.sample\n│   │   ├── fsmonitor-watchman.sample\n│   │   ├── post-update.sample\n│   │   ├── pre-applypatch.sample\n│   │   ├── pre-commit.sample\n│   │   ├── pre-merge-commit.sample\n│   │   ├── pre-push.sample\n│   │   ├── pre-rebase.sample\n│   │   ├── pre-receive.sample\n│   │   ├── prepare-commit-msg.sample\n│   │   ├── push-to-checkout.sample\n│   │   └── update.sample\n│   ├── index\n│   ├── info\n│   │   └── exclude\n│   ├── logs\n│   │   ├── HEAD\n│   │   └── refs\n│   │       ├── heads\n│   │       │   └── main\n│   │       └── remotes\n│   │           └── origin\n│   │               └── main\n│   ├── objects\n│   │   ├── 32\n│   │   │   └── 91e7de4715c57b39dd04cda52b7fd42f9f3fb7\n│   │   ├── 3c\n│   │   │   └── 00233aaca2704ff5eb8b59ea5d3cb00bf4a170\n│   │   ├── 61\n│   │   │   └── 365f6c6bf64e9e8b5a81f2d6161b29f30e3ac0\n│   │   ├── 65\n│   │   │   └── f2274944ed41c8f1f3b23f62d654329e018c65\n│   │   ├── 75\n│   │   │   └── 8e46b40b670dd33c53758979256da27cb3cb4b\n│   │   ├── 93\n│   │   │   └── cb9b7c5a3a5e0e3c36152b091bf9f84f9fc60e\n│   │   ├── bc\n│   │   │   └── fcd82886eb8f9ae9e1c95337f6a3a12f767e8a\n│   │   ├── bf\n│   │   │   └── a8b87102f67ff125f87ef1b8f20eaeb2601e75\n│   │   ├── cc\n│   │   │   └── 0f3f0697c757e92a3fef16fa5624c2e882bf1a\n│   │   ├── info\n│   │   └── pack\n│   ├── refs\n│   │   ├── heads\n│   │   │   └── main\n│   │   ├── remotes\n│   │   │   └── origin\n│   │   │       └── main\n│   │   └── tags\n│   └── shallow\n├── .github\n│   └── workflows\n│       └── main.yml\n├── README.md\n├── action.yml\n├── main.py\n├── tree.bak\n└── tree.sh\n\n28 directories, 40 files\n```\n    \n  \u003c/details\u003e\n\u003c/details\u003e\n\n## 使用  \n### 快速开始  \n1.将以下代码加入需要添加readme-tree功能的仓库的README.md:(位置可自定义)\n```\n\u003c!-- readme-tree start --\u003e\n\u003c!-- readme-tree end --\u003e\n```\n2.在仓库中创建一个actions文件，路径为:`.github/workflows/[这里填写一个名字].yml`，内容如下:\n``` yml\non: [push]\n\njobs:\n  tree:\n    runs-on: ubuntu-latest\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n        uses: RavelloH/readme-tree@latest\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n          git pull\n          git config --local user.email \"actions@github.com\"\n          git config --local user.name \"github-actions\"\n          git add .\n          git commit -m \"[Readme-Tree]`date '+%Y-%m-%d %H:%M:%S'`\" || exit\n          git status\n          git push -f\n```  \n\n(若不希望仓库贡献者中出现github-action-user，也可以将上述代码中的`actions@github.com`与`github-actions`替换为自己的github邮箱及昵称。)\n\n3.大功告成!如果上述操作顺利完成，每次对仓库进行push后都会触发自动生成。若未出现，请检查仓库的Actions功能是否开启、Actions的令牌(Settings\u003eActions\u003eGeneral\u003eWorkflow permissions)是否设置为读写。\n\n### 详细设置\n#### 管理功能选项\n| 功能名             | 描述                            | 可选值  | 默认值  |\n|-------------------|--------------------------------|--------|--------|\n| showall           | 是否展示所有文件及目录             | yes/no | yes    |\n| showdirectoryname | 仅展示文件夹名                    | yes/no | no     |\n| showchangetime    | 显示更改时间(废弃参数，不可用)       | -      | no     |\n| showsize          | 以字节为单位，显示文件大小            | yes/no | no     |\n| showallname       | 显示相对路径                      | yes/no | no     |\n| ignoregit         | 隐藏.git文件                     | yes/no | yes    |\n\n  \n要想单独打开/关闭这些功能，仅需在仓库的yml文件中以with的方式更改。  \n例如，若希望显示文件大小并显示相对路径，并且关闭对.git文件的隐藏，只需这样写:  \n``` yml\n#以上省略......\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n        uses: RavelloH/readme-tree@latest\n        with:\n          showsize: 'yes'\n          showallname: 'yes'\n          ignoregit: 'no'\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n #以下省略......\n ```\n#### 针对长内容进行隐藏\n若内容过长，可以在markdown标签中使用` \u003cdetails\u003e`标签隐藏。 用法如下:\n\n``` html\n \u003cdetails\u003e \n  \u003csummary\u003e显示内容\u003c/summary\u003e\n  \u003c!-- readme-tree start --\u003e\n  \u003c!-- readme-tree end --\u003e\n 这里放置隐藏的内容\n \u003c/details\u003e\n```\n\n效果:\n\u003cdetails\u003e \n  \u003csummary\u003e显示内容\u003c/summary\u003e\n 这里放置隐藏的内容\n \u003c/details\u003e\n若需要默认隐藏readme-tree，将[#快速开始](#快速开始)中提到的代码放入文字区域即可。另外，也可以默认显示，并提供隐藏功能:\n\n``` html\n \u003cdetails open\u003e \n  \u003csummary\u003e显示/隐藏内容\u003c/summary\u003e\n  \u003c!-- readme-tree start --\u003e\n  \u003c!-- readme-tree end --\u003e\n 这里的内容默认显示\n \u003c/details\u003e\n```\n\n效果:\n\u003cdetails open\u003e \n  \u003csummary\u003e显示/隐藏内容\u003c/summary\u003e\n 这里的内容默认显示\n \u003c/details\u003e\n \n### 撤销\n只需在yml文件中这样修改，就可以清除生成的树状图：\n```diff\n#Omitted above......\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n-        uses: RavelloH/readme-tree@latest\n+        uses: RavelloH/readme-tree-undo@latest\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n #Omitted below......\n```\n在 [readme-tree-undo](https://github.com/RavelloH/readme-tree-undo) 中查看详情。\n## 版本\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/ravelloh/readme-tree?label=latest%20%2F%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC\u0026style=for-the-badge)\n![GitHub Release Date](https://img.shields.io/github/release-date/RavelloH/readme-tree?style=for-the-badge)\n\n若想进行版本更改，仅需修改yml配置中`RavelloH/readme-tree`中@后面的版本号即可。默认为保持最新\n\n## 贡献\u0026反馈\n若有任何想法或建议，或者发现了BUG，欢迎您的直接贡献，也欢迎您在这里[提个ISSUE来反馈](https://github.com/RavelloH/readme-tree/issues/new)以更好的帮助此项目\n## LICENCE\n![GitHub](https://img.shields.io/github/license/ravelloh/readme-tree?style=for-the-badge)  \n  \n\u003c/details\u003e\n\n\n \u003cdetails open\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e English \u003c/b\u003e \u003c/summary\u003e\n\n## Performance:\n\u003e The following effects can be combined.\n \u003cdetails open\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e Show/Hide \u003c/b\u003e \u003c/summary\u003e\n  \n### Default\n\n```\n.\n├── .github\n│   └── workflows\n│       └── main.yml\n├── README.md\n├── action.yml\n├── main.py\n└── tree.sh\n\n2 directories, 5 files\n```\n\n### Show only files in the warehouse\n\n```\n.\n├── README.md\n├── action.yml\n├── main.py\n├── tree.bak\n└── tree.sh\n\n0 directories, 5 files\n```\n\n### Show only the directories in the warehouse\n\n```\n.\n└── .github\n    └── workflows\n    \n2 directories\n```\n\n### Display files size(Bytes)\n\n```\n.\n├── [       4096]  .github\n│   └── [       4096]  workflows\n│       └── [        591]  main.yml\n├── [       1018]  README.md\n├── [       4067]  action.yml\n├── [       1677]  main.py\n├── [          0]  tree.bak\n└── [        809]  tree.sh\n\n2 directories, 6 files\n```\n\n### Show relative path\n\n```\n.\n├── ./.github\n│   └── ./.github/workflows\n│       └── ./.github/workflows/main.yml\n├── ./README.md\n├── ./action.yml\n├── ./main.py\n├── ./tree.bak\n└── ./tree.sh\n\n2 directories, 6 files\n```\n\n### Display git file\n\n \u003cdetails\u003e\n  \u003csummary align=\"center\"\u003e \u003cb\u003e Open \u003c/b\u003e \u003c/summary\u003e\n    \n```\n.\n├── .git\n│   ├── FETCH_HEAD\n│   ├── HEAD\n│   ├── branches\n│   ├── config\n│   ├── description\n│   ├── hooks\n│   │   ├── applypatch-msg.sample\n│   │   ├── commit-msg.sample\n│   │   ├── fsmonitor-watchman.sample\n│   │   ├── post-update.sample\n│   │   ├── pre-applypatch.sample\n│   │   ├── pre-commit.sample\n│   │   ├── pre-merge-commit.sample\n│   │   ├── pre-push.sample\n│   │   ├── pre-rebase.sample\n│   │   ├── pre-receive.sample\n│   │   ├── prepare-commit-msg.sample\n│   │   ├── push-to-checkout.sample\n│   │   └── update.sample\n│   ├── index\n│   ├── info\n│   │   └── exclude\n│   ├── logs\n│   │   ├── HEAD\n│   │   └── refs\n│   │       ├── heads\n│   │       │   └── main\n│   │       └── remotes\n│   │           └── origin\n│   │               └── main\n│   ├── objects\n│   │   ├── 32\n│   │   │   └── 91e7de4715c57b39dd04cda52b7fd42f9f3fb7\n│   │   ├── 3c\n│   │   │   └── 00233aaca2704ff5eb8b59ea5d3cb00bf4a170\n│   │   ├── 61\n│   │   │   └── 365f6c6bf64e9e8b5a81f2d6161b29f30e3ac0\n│   │   ├── 65\n│   │   │   └── f2274944ed41c8f1f3b23f62d654329e018c65\n│   │   ├── 75\n│   │   │   └── 8e46b40b670dd33c53758979256da27cb3cb4b\n│   │   ├── 93\n│   │   │   └── cb9b7c5a3a5e0e3c36152b091bf9f84f9fc60e\n│   │   ├── bc\n│   │   │   └── fcd82886eb8f9ae9e1c95337f6a3a12f767e8a\n│   │   ├── bf\n│   │   │   └── a8b87102f67ff125f87ef1b8f20eaeb2601e75\n│   │   ├── cc\n│   │   │   └── 0f3f0697c757e92a3fef16fa5624c2e882bf1a\n│   │   ├── info\n│   │   └── pack\n│   ├── refs\n│   │   ├── heads\n│   │   │   └── main\n│   │   ├── remotes\n│   │   │   └── origin\n│   │   │       └── main\n│   │   └── tags\n│   └── shallow\n├── .github\n│   └── workflows\n│       └── main.yml\n├── README.md\n├── action.yml\n├── main.py\n├── tree.bak\n└── tree.sh\n\n28 directories, 40 files\n```\n    \n  \u003c/details\u003e\n\u003c/details\u003e\n\n## How to use  \n### Quick start \n1.Add the following code to the README.md of the repo that needs to add the readme-tree function: (the location can be customized)\n```\n\u003c!-- readme-tree start --\u003e\n\u003c!-- readme-tree end --\u003e\n```\n2.Create an actions file in the repo, the path is: `.GitHub/workflows/[fill in a name here].yml`, and the content is as follows:\n``` yml\non: [push]\n\njobs:\n  tree:\n    runs-on: ubuntu-latest\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n        uses: RavelloH/readme-tree@latest\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n          git pull\n          git config --local user.email \"actions@github.com\"\n          git config --local user.name \"github-actions\"\n          git add .\n          git commit -m \"[Readme-Tree]`date '+%Y-%m-%d %H:%M:%S'`\" || exit\n          git status\n          git push -f\n```  \n\n(If you don't want GitHub-action user in the repo contributor, you can also change `actions@github.com` and `GitHub actions` with your own GitHub mailbox and nickname.)\n\n3.Be accomplished! If the above operations are successfully completed, automatic generation will be triggered every time the warehouse is pushed.If not, please check whether the actions function of the warehouse is enabled, and whether the actions token (settings\u003eactions\u003egeneral\u003eworkflow permissions) is set to read and write.\n\n### Detailed settings\n#### Manage function options\n| Function name     | Describe                       | Optional value  | Default value |\n|-------------------|--------------------------------|--------|--------|\n| showall           | Are all documents and directories displayed   | yes/no | yes    |\n| showdirectoryname | Show folder name only                  | yes/no | no     |\n| showchangetime    | Display the change time (obsolete parameters, unavailable)     | -      | no     |\n| showsize          | Displays the file size in bytes           | yes/no | no     |\n| showallname       | Show relative path                      | yes/no | no     |\n| ignoregit         | Hide .Git files                     | yes/no | yes    |\n\n\nTo turn these functions on / off separately, you only need to change them in the YML file of the warehouse in the way of with.   \nFor example, if you want to display the file size and relative path, and turn off hiding the.Git file, just write this:    \n```diff\n#Omitted above......\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n        uses: RavelloH/readme-tree@latest\n+        with:\n+          showsize: 'yes'\n+          showallname: 'yes'\n+          ignoregit: 'no'\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n #Omitted below......\n ```\n#### Hide long content\nIf the content is too long, you can hide it with the ` \u003cdetails\u003e` tag in the markdown tag. The usage is as follows:\n\n``` html\n \u003cdetails\u003e \n  \u003csummary\u003eShow\u003c/summary\u003e\n  \u003c!-- readme-tree start --\u003e\n  \u003c!-- readme-tree end --\u003e\n \u003c/details\u003e\n```\n\nResult:\n\u003cdetails\u003e \n  \u003csummary\u003eShow\u003c/summary\u003e\n Here is the hidden content\n \u003c/details\u003e\nIf you need to hide readme tree by default, put the code mentioned in (\\quick start) into the text area. In addition, it can also be displayed by default, and the hidden function is provided:  \n   \n``` html\n \u003cdetails open\u003e \n  \u003csummary\u003eShow/Hide\u003c/summary\u003e\n \u003c!-- readme-tree start --\u003e\n \u003c!-- readme-tree end --\u003e\n \u003c/details\u003e\n```\n\nResult:\n\u003cdetails open\u003e \n  \u003csummary\u003eShow/Hide\u003c/summary\u003e\n The content here is displayed by default\n \u003c/details\u003e\n\n### Undo\nSimply modify it in the YML file to clear the generated tree view:\n```diff\n#Omitted above......\n    name: readme-tree\n    steps:\n      - uses: actions/checkout@v3\n      - name: Tree\n-        uses: RavelloH/readme-tree@latest\n+        uses: RavelloH/readme-tree-undo@latest\n      - name: commit\n        continue-on-error: True\n        run: |\n          git init\n #Omitted below......\n```\nView more on [readme-tree-undo](https://github.com/RavelloH/readme-tree-undo)\n\n## Version\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/ravelloh/readme-tree?label=latest%20%2F%20%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC\u0026style=for-the-badge)\n![GitHub Release Date](https://img.shields.io/github/release-date/RavelloH/readme-tree?style=for-the-badge)\n\nIf you want to make a version change, you only need to modify the version number after @ in 'ravelloh / readme tree' in YML configuration. The default is to keep it up to date\n\n## Contribution \u0026 feedback\nIf you have any ideas or suggestions, or find bugs, you are welcome to contribute directly, and you are also welcome to [put forward an issue for feedback](https://github.com/RavelloH/readme-tree/issues/new) here to better help this project\n\n## LICENCE\n![GitHub](https://img.shields.io/github/license/ravelloh/readme-tree?style=for-the-badge)\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravelloh%2Freadme-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fravelloh%2Freadme-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravelloh%2Freadme-tree/lists"}