Skip to content

Commit fb119ba

Browse files
committed
Auto-update nav and content
1 parent 4dd4b86 commit fb119ba

File tree

4 files changed

+51
-19
lines changed

4 files changed

+51
-19
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ jobs:
2525
run: |
2626
pip install mkdocs-material pyyaml
2727
28-
- name: Generate mkdocs.yml nav
29-
run: python generate_nav.py
28+
- name: Build MkDocs site (to verify)
29+
run: mkdocs build --strict
3030

3131
- name: Create CNAME file
3232
run: echo "tep.cyberpax.cloud" > docs/CNAME
3333

34-
- name: List built site contents (debug)
35-
run: |
36-
mkdocs build
37-
echo "🔍 Site files:"
38-
ls -R site/
39-
4034
- name: Deploy to GitHub Pages
41-
run: mkdocs gh-deploy --force
35+
run: mkdocs gh-deploy --force

docs/Defender for Endpoint/Endpoint Detection and Response/Microsoft Defender Core Service/ecs_connectivity_diagnostic.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ This article provides a PowerShell-based diagnostic approach to validate and cap
1010

1111
**ECS (Endpoint Configuration Service)** is a Microsoft cloud service used by Windows Defender and Microsoft Defender for Endpoint (MDE) clients to retrieve configuration data such as feature flags, diagnostic settings, and platform behavior instructions. ECS URLs are dynamically assigned and can vary based on region, tenant, or client configuration.
1212

13-
> [ECS documentation: (https://learn.microsoft.com/en-us/defender-endpoint/microsoft-defender-core-service-overview)]
13+
> [ECS documentation](https://learn.microsoft.com/en-us/defender-endpoint/microsoft-defender-core-service-overview)
14+
1415

1516
---
1617

generate_nav.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
IGNORE_DIRS = {"stylesheets", "__pycache__", "images"}
77
IGNORE_FILES = {"_Sidebar.md", "index.md"}
88

9+
# Custom top-level order
10+
PRIORITY_ORDER = [
11+
"Defender for Endpoint",
12+
"Support Tips and Tools",
13+
"Derecho informático"
14+
]
15+
916
def collect_docs(path):
1017
tree = []
1118
entries = sorted(os.listdir(path), key=str.casefold)
@@ -22,23 +29,53 @@ def collect_docs(path):
2229
tree.append({label: rel_path})
2330
return tree
2431

32+
def sort_nav(nav):
33+
prioritized = []
34+
remaining = []
35+
36+
for item in nav:
37+
section = list(item.keys())[0]
38+
if section in PRIORITY_ORDER:
39+
prioritized.append((PRIORITY_ORDER.index(section), item))
40+
else:
41+
remaining.append(item)
42+
43+
prioritized.sort(key=lambda x: x[0])
44+
remaining.sort(key=lambda x: list(x.keys())[0].lower())
45+
return [i[1] for i in prioritized] + remaining
46+
2547
def build_mkdocs_config(nav):
26-
with open("mkdocs.yml", "r", encoding="utf-8") as f:
48+
config_path = "mkdocs.yml"
49+
50+
with open(config_path, "r", encoding="utf-8") as f:
2751
config = yaml.safe_load(f)
2852

29-
config["nav"] = [{"Home": "index.md"}] + nav
53+
new_nav = [{"Home": "index.md"}] + sort_nav(nav)
54+
config["nav"] = new_nav
3055

31-
with open("mkdocs.yml", "w", encoding="utf-8") as f:
56+
with open(config_path, "w", encoding="utf-8") as f:
3257
yaml.dump(config, f, sort_keys=False, allow_unicode=True)
3358

3459
print("✅ Navigation updated in mkdocs.yml")
3560

3661
def git_commit_and_push():
62+
# Check for any changes (staged or not)
63+
result = subprocess.run(["git", "status", "--porcelain"], capture_output=True, text=True)
64+
if result.stdout.strip() == "":
65+
print("⚠️ No changes to commit.")
66+
return
67+
68+
print("📦 Staging and committing changes...")
3769
subprocess.run(["git", "add", "."], check=True)
38-
subprocess.run(["git", "commit", "-m", "Auto-update nav, commit changes, trigger deploy"], check=False)
70+
subprocess.run(["git", "commit", "-m", "Auto-update nav and content"], check=False)
3971
subprocess.run(["git", "push", "origin", "main"], check=True)
72+
print("✅ Git commit and push completed.")
4073

4174
if __name__ == "__main__":
75+
print("📁 Collecting docs...")
4276
nav = collect_docs(DOCS_DIR)
77+
78+
print("🧭 Building mkdocs.yml...")
4379
build_mkdocs_config(nav)
80+
4481
git_commit_and_push()

mkdocs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ extra_css:
99
- stylesheets/layout.css
1010
nav:
1111
- Home: index.md
12-
- Day-to-Day Stuff:
13-
- Birthday Reminders: Day-to-Day Stuff/birthday-reminders.md
1412
- Defender for Endpoint:
1513
- Endpoint Detection and Response:
1614
- Alert Tunning:
@@ -35,11 +33,13 @@ nav:
3533
- Threat Vulnerability Management:
3634
- Troubleshooting Guide (Tsg) Cve‐2023‐49210 – Openssl Vulnerability In Node‐Openssl Npm Package: Defender
3735
for Endpoint/Endpoint Detection and Response/Threat Vulnerability Management/Troubleshooting-Guide-(TSG)-CVE‐2023‐49210-–-OpenSSL-Vulnerability-in-node‐openssl-NPM-Package.md
36+
- Support Tips and Tools:
37+
- Effective Case Notation Good Practices And Template: Support Tips and Tools/Effective-Case-Notation-Good-practices-and-template.md
38+
- How To Craft An Effective Root Cause Analysis (Rca): Support Tips and Tools/How-to-Craft-an-Effective-Root-Cause-Analysis-(RCA).md
3839
- Derecho informático:
3940
- Delitos Informáticos En Costa Rica Mapeo Jurídico‐Técnico Y Controles Att&Ck: Derecho
4041
informático/Delitos-Informáticos-en-Costa-Rica-Mapeo-Jurídico‐Técnico-y-Controles-ATT&CK.md
4142
- Reflexión, Bienes Jurídicos Tutelados En Una Eventual Legislación De Ia En Costa Rica: Derecho
4243
informático/Reflexión,-Bienes-jurídicos-tutelados-en-una-eventual-legislación-de-IA-en-Costa-Rica.md
43-
- Support Tips and Tools:
44-
- Effective Case Notation Good Practices And Template: Support Tips and Tools/Effective-Case-Notation-Good-practices-and-template.md
45-
- How To Craft An Effective Root Cause Analysis (Rca): Support Tips and Tools/How-to-Craft-an-Effective-Root-Cause-Analysis-(RCA).md
44+
- Day-to-Day Stuff:
45+
- Birthday Reminders: Day-to-Day Stuff/birthday-reminders.md

0 commit comments

Comments
 (0)