Skip to content

Script ‐ Auto Create Repo Labels for Specified Repos

Sandy Wang edited this page Nov 2, 2025 · 1 revision

Script - Auto Create Repo Labels for Specified Repos

The script reads the list of labels and automatically creates them for specified repos.

Status

Completed

Files

  • ai-skills-assessor/.github/workflows/labels_json_update.yaml

  • ai-skills-assessor/.github/workflows/repo-update.yml

  • ai-skills-assessor/API_repo_labels/scripts/excel_to_json.py

  • ai-skills-assessor/API_repo_labels/scripts/repo_labeler.py

  • ai-skills-assessor/API_repo_labels/data/excel_labels_data.xlsx

  • ai-skills-assessor/API_repo_labels/data/labels_data.json

Note: The following file was used during development and is not included as part of the final solution, thus it can be ignored:

  • ai-skills-assessor/API_repo_labels/scripts/label_delete.py

File details

  • ai-skills-assessor/.github/workflows/labels_json_update.yaml:

    • This GitHub Actions workflow installs dependencies, sets up Python 3.11, and runs a script to convert an Excel file of label data into a JSON file. It is triggered manually or whenever the Excel file changes, and it automatically commits and pushes the updated JSON back to the repository.
  • ai-skills-assessor/.github/workflows/repo-update.yml:

    • This GitHub Actions workflow installs dependencies, sets up Python 3.11, and runs a script to automatically add labels to multiple target repositories listed in a JSON file. It is triggered manually from the Actions tab and requires a GitHub token with admin access to update labels and commit changes to the JSON file.
  • ai-skills-assessor/API_repo_labels/scripts/excel_to_json.py

    • This Python script reads an Excel file of label definitions, filters for confirmed labels, cleans and processes the data to create fields like name, description, series, keywords, and color, maps each series to a predefined color, and outputs the results as a JSON file (labels_data.json) for use in automated labeling workflows.
  • ai-skills-assessor/API_repo_labels/scripts/repo_labeler.py

    • This Python script automates creating GitHub labels for a specified repository using the GitHub REST API. It first checks that the provided token has sufficient access (admin or push), loads label definitions from a JSON file, and then creates any labels that don’t already exist via the API, handling rate limits, retries, and skipped labels. It logs progress, warnings, and errors throughout, ensuring only valid labels are created while respecting GitHub API limits.
  • ai-skills-assessor/API_repo_labels/data/excel_labels_data.xlsx

    • This Excel file should be updated manually when labels have been modified. Committing changes to this file will trigger the labels_json_update.yaml workflow to update the labels json.
  • ai-skills-assessor/API_repo_labels/data/labels_data.json

    • This json file includes the cleaned up, ready for use version of the labels list.

Clone this wiki locally