This repository provides:
- A single CLI entrypoint for common operations:
- Convert
readme.toml⇄README.md - Bulk-trigger course repositories GitHub Actions workflows
- Fetch and maintain the organization repositories list (
repos_list.txt)
- Convert
- The reusable GitHub Actions workflow used by course repositories to generate/update their worktrees.
The preferred way to use this repo is:
python3 -m repos_management --help- Python 3.11+
- Optional (recommended): GitHub CLI (
gh)
python3 -m repos_management rdme toml2md --input path/to/readme.toml --overwritepython3 -m repos_management rdme md2toml --input path/to/README.md --overwritepython3 -m repos_management workflow trigger --delay 2Dry-run:
python3 -m repos_management workflow trigger --dry-run- Uses
GITHUB_TOKENif set. - Otherwise falls back to
gh auth token.
The token must be able to dispatch workflows (typical scopes: repo, workflow).
- Uses
PERSONAL_ACCESS_TOKENfrom env or.env. - You can also pass
--tokenexplicitly.
Typical scopes: read:org, repo.
Convert readme.toml → README.md.
python3 -m repos_management rdme toml2md --input <file-or-dir> [--output <file>] [--overwrite]- If
--inputis a directory, it scans**/readme.tomland writesREADME.mdnext to each file.
Convert README.md → readme.toml.
python3 -m repos_management rdme md2toml --input <file-or-dir> [--output <file>] [--overwrite] [--verbose]- If
--inputis a directory, it scans**/README.mdand writesreadme.tomlnext to each file.
Trigger each course repo workflow file (default: trigger-workflow.yml) via workflow_dispatch.
python3 -m repos_management workflow trigger \
--org HITSZ-OpenAuto \
--repos-file repos_list.txt \
--workflow-file trigger-workflow.yml \
--ref main \
--delay 2Fetch repositories under an org and write repos_list.txt.
python3 -m repos_management repos fetch --org HITSZ-OpenAutoOnly the new lecturers schema is supported:
[lecturers]
[[lecturers.intro]]
content = "..." # optional
# author is optional
# author = { name = "", link = "", date = "" }
[[lecturers.items]]
name = "郑宜峰"
[[lecturers.items.reviews]]
content = "挺好的老师,交流时感觉很亲切。"
# author is optional
# author = { name = "xxx", link = "xxx", date = "xxx" }
[[lecturers.summary]]
content = "..." # optionalLegacy TOML [[lecturers]] / [[lecturers.reviews]] is not supported and will raise an error.
A typical course repository contains:
.github/workflows/trigger-workflow.yml
This workflow calls the reusable workflow in this repo:
uses: HITSZ-OpenAuto/repos-management/.github/workflows/reusable_worktree_generate.yml@mainTo update all course repositories after repos-management changes are merged to main, run:
python3 -m repos_management workflow triggerSome power tools remain in ./scripts/ (use with care):
add_workflow.sh- 为课程仓库添加/更新 workflow 文件(通过 PR)add_licenses.py- 批量添加 LICENSE 文件(通过 PR)add_secrets.sh- 批量添加 GitHub secretsapprove_pr.sh- 批量审核通过 PRclose_pr.sh- 批量关闭 PRbatch_trigger_workflows.sh- 批量触发工作流(已废弃,使用 CLI)
delete_dir.sh- 删除仓库中的目录batch_delete.sh- 批量删除多仓库中的目录
convert_toml_to_readme.py- Convert TOML to READMEreadme_to_toml.py- Convert README to TOML
generate_worktree_info.py- Generate worktree info JSONrdme_autogen.py- Used by course repositories CI to orchestrate conversionpull_or_clone.py- Pull or clone repositoriesfetch_repos.py- Fetch repositories list
The following scripts have been consolidated into the CLI (python3 -m repos_management):
| Legacy Script | Current CLI Command |
|---|---|
batch_trigger_workflows.sh |
python3 -m repos_management workflow trigger |
If you need the original scripts, they are available in git history:
git show <commit>:scripts/add_workflow.sh