mirror of
https://github.com/nubenetes/awesome-kubernetes.git
synced 2026-05-29 12:33:58 +00:00
fix(workflows): correct tag property access and yaml dump format in critical asset monitor
This commit is contained in:
7
.github/workflows/critical_asset_monitor.yml
vendored
7
.github/workflows/critical_asset_monitor.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
with open('data/inventory.yaml', 'r') as f:
|
||||
inv = yaml.safe_load(f) or {}
|
||||
|
||||
critical_links = [u for u, d in inv.items() if d.get('tag') in ['[DE FACTO STANDARD]', '[ENTERPRISE-STABLE]']]
|
||||
critical_links = [u for u, d in inv.items() if any(t in ['[DE FACTO STANDARD]', '[ENTERPRISE-STABLE]'] for t in d.get('tags', []))]
|
||||
print(f'[*] Auditing {len(critical_links)} critical assets...')
|
||||
|
||||
dead = []
|
||||
@@ -65,10 +65,13 @@ jobs:
|
||||
with open('data/inventory.yaml', 'w') as f:
|
||||
yaml.dump(inv, f, sort_keys=False, allow_unicode=True)
|
||||
|
||||
with open('data/inventory.yaml', 'r') as f:
|
||||
updated_inv = f.read()
|
||||
|
||||
# Create PR/Issue
|
||||
git = RepositoryController(os.environ['GH_TOKEN'], 'nubenetes/awesome-kubernetes')
|
||||
body = '### 🚨 Critical Assets Offline\n\n' + '\n'.join([f'- {u}' for u in dead])
|
||||
git.apply_multi_file_changes({'data/inventory.yaml': yaml.dump(inv)}, {'removals': len(dead)})
|
||||
git.apply_multi_file_changes({'data/inventory.yaml': updated_inv}, {'removals': len(dead)})
|
||||
print('[OK] Inventory updated and PR created.')
|
||||
else:
|
||||
print('[OK] All critical assets are online.')
|
||||
|
||||
Reference in New Issue
Block a user