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)
-
Create a Token in GitHub's web interface at
Settings
→Developer settings
→Personal access tokens
-
Required Permissions: At least
repo
andworkflow
-
Save to
.env
file:PERSONAL_ACCESS_TOKEN=<your_token_here>
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
- If overwriting, place the updated content after
read -r -d '' WORKFLOW_CONTENT << 'EOF'
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_list
list
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