diff --git a/.github/workflows/critical_asset_monitor.yml b/.github/workflows/critical_asset_monitor.yml index fe874c15..9ac23901 100644 --- a/.github/workflows/critical_asset_monitor.yml +++ b/.github/workflows/critical_asset_monitor.yml @@ -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.')