Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions .github/repos-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"repositories": [
{
"name": "AMDMIGraphX",
"url": "ROCm/AMDMIGraphX",
"branch": "develop"
},
{
"name": "MIOpen",
"url": "ROCm/MIOpen",
"branch": "develop"
},
{
"name": "MIVisionX",
"url": "ROCm/MIVisionX",
"branch": "develop"
},
{
"name": "Tensile",
"url": "ROCm/Tensile",
"branch": "develop"
},
{
"name": "TransferBench",
"url": "ROCm/TransferBench",
"branch": "develop"
},
{
"name": "composable_kernel",
"url": "ROCm/composable_kernel",
"branch": "develop"
},
{
"name": "hipBLAS",
"url": "ROCm/hipBLAS",
"branch": "develop"
},
{
"name": "hipBLAS-common",
"url": "ROCm/hipBLAS-common",
"branch": "develop"
},
{
"name": "hipBLASLt",
"url": "ROCm/hipBLASLt",
"branch": "develop"
},
{
"name": "hipCUB",
"url": "ROCm/hipCUB",
"branch": "develop"
},
{
"name": "hipFFT",
"url": "ROCm/hipFFT",
"branch": "develop"
},
{
"name": "hipRAND",
"url": "ROCm/hipRAND",
"branch": "develop"
},
{
"name": "hipSOLVER",
"url": "ROCm/hipSOLVER",
"branch": "develop"
},
{
"name": "hipSPARSE",
"url": "ROCm/hipSPARSE",
"branch": "develop"
},
{
"name": "hipSPARSELt",
"url": "ROCm/hipSPARSELt",
"branch": "develop"
},
{
"name": "hipTensor",
"url": "ROCm/hipTensor",
"branch": "develop"
},
{
"name": "hipfort",
"url": "ROCm/hipfort",
"branch": "develop"
},
{
"name": "Oragami",
"url": "ROCm/Oragami",
"branch": "develop"
},
{
"name": "rccl",
"url": "ROCm/rccl",
"branch": "develop"
},
{
"name": "rocAL",
"url": "ROCm/rocAL",
"branch": "develop"
},
{
"name": "rocALUTION",
"url": "ROCm/rocALUTION",
"branch": "develop"
},
{
"name": "rocBLAS",
"url": "ROCm/rocBLAS",
"branch": "develop"
},
{
"name": "rocDecode",
"url": "ROCm/rocDecode",
"branch": "develop"
},
{
"name": "rocFFT",
"url": "ROCm/rocFFT",
"branch": "develop"
},
{
"name": "rocJPEG",
"url": "ROCm/rocJPEG",
"branch": "develop"
},
{
"name": "rocJenkins",
"url": "ROCm/rocJenkins",
"branch": "pong"
},
{
"name": "rocPRIM",
"url": "ROCm/rocPRIM",
"branch": "develop"
},
{
"name": "rocPyDecode",
"url": "ROCm/rocPyDecode",
"branch": "develop"
},
{
"name": "rocRAND",
"url": "ROCm/rocRAND",
"branch": "develop"
},
{
"name": "rocRoller",
"url": "ROCm/rocRoller",
"branch": "main"
},
{
"name": "rocSHMEM",
"url": "ROCm/rocSHMEM",
"branch": "develop"
},
{
"name": "rocSOLVER",
"url": "ROCm/rocSOLVER",
"branch": "develop"
},
{
"name": "rocSPARSE",
"url": "ROCm/rocSPARSE",
"branch": "develop"
},
{
"name": "rocThrust",
"url": "ROCm/rocThrust",
"branch": "develop"
},
{
"name": "rocWMMA",
"url": "ROCm/rocWMMA",
"branch": "develop"
},
{
"name": "rpp",
"url": "ROCm/rpp",
"branch": "develop"
}
]
}
64 changes: 64 additions & 0 deletions .github/scripts/apply-labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import sys
import yaml
import requests

def get_existing_labels(repo, token):
headers = {"Authorization": f"token {token}"}
labels = {}
page = 1
while True:
url = f"https://api.github.com/repos/{repo}/labels?page={page}&per_page=100"
resp = requests.get(url, headers=headers)
if resp.status_code != 200:
raise Exception(f"Failed to fetch existing labels: {resp.text}")
data = resp.json()
if not data:
break
for label in data:
labels[label["name"]] = {
"color": label["color"],
"description": label.get("description", "")
}
page += 1
return labels

def create_or_update_label(repo, token, label, existing):
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github+json"
}

if label["name"] not in existing:
# Create label
print(f"Creating label: {label['name']}")
url = f"https://api.github.com/repos/{repo}/labels"
resp = requests.post(url, json=label, headers=headers)
else:
# Update if different
current = existing[label["name"]]
if (label["color"].lower() != current["color"].lower() or
label.get("description", "") != current.get("description", "")):
print(f"Updating label: {label['name']}")
url = f"https://api.github.com/repos/{repo}/labels/{label['name']}"
resp = requests.patch(url, json=label, headers=headers)
else:
print(f"Label '{label['name']}' already up to date. Skipping.")
return

if not resp.ok:
print(f"Failed to apply label {label['name']}: {resp.status_code} {resp.text}")

def main(label_file):
token = os.environ["GH_TOKEN"]
repo = os.environ["GITHUB_REPO"]
existing = get_existing_labels(repo, token)

with open(label_file, "r") as f:
labels = yaml.safe_load(f)

for label in labels:
create_or_update_label(repo, token, label, existing)

if __name__ == "__main__":
main(sys.argv[1])
48 changes: 48 additions & 0 deletions .github/scripts/collect-labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import json
import os
import sys
import requests
import yaml

def get_labels(repo, token):
headers = {"Authorization": f"token {token}"}
labels = []
page = 1
while True:
url = f"https://api.github.com/repos/{repo}/labels?page={page}&per_page=100"
resp = requests.get(url, headers=headers)
if resp.status_code != 200:
raise Exception(f"Failed to fetch labels from {repo}: {resp.text}")
data = resp.json()
if not data:
break
labels.extend(data)
page += 1
return labels

def main(file_path):
with open(file_path, "r") as f:
repos_data = json.load(f)["repositories"]

token = os.environ["GH_TOKEN"]
all_labels = {}

for repo_entry in repos_data:
repo_url = repo_entry["url"]
print(f"Collecting labels from {repo_url}")
for label in get_labels(repo_url, token):
name = label["name"]
if name not in all_labels:
all_labels[name] = {
"name": name,
"color": label["color"],
"description": label.get("description", "")
}

sorted_labels = sorted(all_labels.values(), key=lambda l: l["name"].lower())
os.makedirs(".github", exist_ok=True) # Ensure the .github directory exists
with open(".github/labels.yml", "w") as out:
yaml.dump(sorted_labels, out, sort_keys=False)

if __name__ == "__main__":
main(sys.argv[1])
54 changes: 54 additions & 0 deletions .github/scripts/merge-codeowners.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
from pathlib import Path

# Determine monorepo root and output CODEOWNERS path
monorepo_root = Path(__file__).resolve().parents[2]
output_path = monorepo_root / ".github" / "CODEOWNERS"

merged_entries = []

# Walk top-level directories (excluding .github/.git/etc.)
for subdir in monorepo_root.iterdir():
if subdir.name.startswith(".") or not subdir.is_dir():
continue

# Look for CODEOWNERS in root or .github directory of the submodule
candidates = [subdir / "CODEOWNERS", subdir / ".github" / "CODEOWNERS"]

for codeowners_file in candidates:
if codeowners_file.is_file():
with codeowners_file.open("r") as f:
for line in f:
stripped = line.strip()

# Skip empty lines or comments
if not stripped or stripped.startswith("#"):
continue

parts = stripped.split()
if not parts:
continue

original_path = parts[0]
owners = " ".join(parts[1:])

# Ensure prefixed path starts with a single slash
prefixed_path = (
f"/{subdir.name.rstrip('/')}{original_path}"
if original_path.startswith("/")
else f"/{subdir.name}/{original_path}"
)

merged_entries.append(f"{prefixed_path} {owners}")

# Sort for consistency
merged_entries.sort()

# Write merged CODEOWNERS file
output_path.parent.mkdir(parents=True, exist_ok=True)

with output_path.open("w") as out:
out.write("# Auto-generated CODEOWNERS file\n\n")
out.write("\n".join(merged_entries))

print(f"✅ Merged CODEOWNERS written to {output_path}")
32 changes: 32 additions & 0 deletions .github/workflows/apply-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Apply Labels

on:
workflow_dispatch:
inputs:
labelFile:
description: 'Path to YAML file with labels'
required: true
default: '.github/labels.yml'

jobs:
apply-labels:
runs-on: ubuntu-latest

steps:
- name: Checkout monorepo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Install dependencies
run: pip install PyYAML requests

- name: Apply labels to monorepo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
run: |
python .github/scripts/apply-labels.py "${{ github.event.inputs.labelFile }}"
Loading