ci: validate maintainers also checks for duplicate maintainers
We dont want need to maintain duplicate entries for maintainers in HM that already exist in Nixpkgs. Add a check that calls out users that don't need an entry in our internal list. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
31242bdf8f
commit
18e1f7fbce
1 changed files with 43 additions and 0 deletions
43
.github/workflows/validate-maintainers.yml
vendored
43
.github/workflows/validate-maintainers.yml
vendored
|
|
@ -72,6 +72,49 @@ jobs:
|
|||
print('✅ All maintainer entries are valid')
|
||||
print(f'✅ Validated {len(maintainers)} maintainer entries')
|
||||
"
|
||||
- name: Check for duplicate maintainers
|
||||
run: |
|
||||
echo "🔍 Checking for duplicate maintainers between HM and nixpkgs..."
|
||||
python3 -c "
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
hm_result = subprocess.run(['nix', 'eval', '--file', 'modules/lib/maintainers.nix', '--json'],
|
||||
capture_output=True, text=True, check=True)
|
||||
hm_maintainers = json.loads(hm_result.stdout)
|
||||
hm_github_users = set()
|
||||
for name, data in hm_maintainers.items():
|
||||
if 'github' in data:
|
||||
hm_github_users.add(data['github'])
|
||||
|
||||
nixpkgs_result = subprocess.run(['nix', 'eval', 'nixpkgs#lib.maintainers', '--json'],
|
||||
capture_output=True, text=True, check=True)
|
||||
nixpkgs_maintainers = json.loads(nixpkgs_result.stdout)
|
||||
nixpkgs_github_users = set()
|
||||
for name, data in nixpkgs_maintainers.items():
|
||||
if isinstance(data, dict) and 'github' in data:
|
||||
nixpkgs_github_users.add(data['github'])
|
||||
|
||||
duplicates = hm_github_users.intersection(nixpkgs_github_users)
|
||||
|
||||
if duplicates:
|
||||
print(f'❌ Found {len(duplicates)} duplicate maintainers between HM and nixpkgs:')
|
||||
for github_user in sorted(duplicates):
|
||||
# Find the HM attribute name for this github user
|
||||
hm_attr = None
|
||||
for attr_name, data in hm_maintainers.items():
|
||||
if data.get('github') == github_user:
|
||||
hm_attr = attr_name
|
||||
break
|
||||
print(f' - {github_user} (HM attribute: {hm_attr})')
|
||||
print()
|
||||
print('These maintainers should be removed from HM maintainers file to avoid duplication.')
|
||||
print('They can be referenced directly from nixpkgs instead.')
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('✅ No duplicate maintainers found')
|
||||
"
|
||||
- name: Test generation
|
||||
if: inputs.run_tests == true
|
||||
run: |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue