The scripts in this repository are designed to manage repositories within an organization, specifically for the HITSZ-OpenAuto organization. They facilitate tasks such as fetching repository names, approving pull requests, adding workflows, and managing licenses and secrets.
- Operating System: Linux
- Tool Dependencies:
- Git
- GitHub CLI
- Python 3 (Recommended 3.9 or higher)
-
Log in to GitHub CLI
gh auth login
-
Create a Token in GitHub: https://github.com/settings/tokens/new
-
Required Permissions: At least
repoandworkflow -
Export an environment variable on macOS or Linux systems
export PERSONAL_ACCESS_TOKEN=<your_token_here>
-
To run a shell script, use the following command format:
bash ./scripts/<script_name>.sh
Fetch all repository names (excluding 'HITSZ-OpenAuto', '.github', and 'hoa-moe')
List of all repositories in the organization
- Note: Line endings should be LF (Linux newline character)
Batch approve the latest PRs for all repositories listed in repos_list.txt
- Typically used for updating repository workflows
Batch add/overwrite workflow files for all repositories listed in repos_list.txt. The workflow content is sourced from the root-level call_worktree_update.yml in the online repository HITSZ-OpenAuto/repos-management
Perform the following for all repositories:
- If the local folder exists → Pull the main branch
- If the folder doesn't exist → Clone the repository
- Exclude specific repositories using the
bypass_listlist
Collect repository file information (including filenames, sizes, and modification times), saved as a .json formatted file
Batch add license files to all repositories listed in repos_list.txt
Batch add Secrets to all repositories listed in repos_list.txt