-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path08-maintenance_docs-orphan-check.yml
More file actions
139 lines (125 loc) · 4.48 KB
/
Copy path08-maintenance_docs-orphan-check.yml
File metadata and controls
139 lines (125 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Docs Orphan Check
# Detects orphaned module-doc directories in docs/de and docs/en and reports
# broken PRIMARY_SOURCES references back to supported source-doc roots
# such as src/, include/, examples/, tools/, benchmarks/, tests/,
# and external/chimera/.
#
# Triggers:
# - Push to develop/main that touches supported source-doc roots or docs/de/, docs/en/
# - Any pull_request touching those paths
# - Daily schedule at 04:00 UTC
# - Manual dispatch
on:
push:
branches: [develop, main]
paths:
- 'src/*/**'
- 'include/*/**'
- 'examples/*/**'
- 'tools/*/**'
- 'benchmarks/*/**'
- 'tests/*/**'
- 'docs/de/**'
- 'docs/en/**'
- 'tools/module_docs_builder.py'
- 'scripts/docs-orphan-check.py'
- '.github/workflows/08-maintenance_docs-orphan-check.yml'
pull_request:
branches: [develop, main]
paths:
- 'src/*/**'
- 'include/*/**'
- 'examples/*/**'
- 'tools/*/**'
- 'benchmarks/*/**'
- 'tests/*/**'
- 'docs/de/**'
- 'docs/en/**'
- 'tools/module_docs_builder.py'
- 'scripts/docs-orphan-check.py'
- '.github/workflows/08-maintenance_docs-orphan-check.yml'
schedule:
- cron: '0 4 * * *' # Daily at 04:00 UTC
workflow_dispatch:
inputs:
fail_on_findings:
description: 'Fail the workflow when orphan module-doc dirs or broken references are found'
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
name: docs/de + docs/en Orphan Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run docs orphan check
id: orphan_check
run: |
FAIL_FLAG=""
if [ "${{ inputs.fail_on_findings }}" = "true" ]; then
FAIL_FLAG="--fail-on-findings"
fi
python3 scripts/docs-orphan-check.py \
--format text \
--output /tmp/docs-orphan-check.txt \
$FAIL_FLAG
- name: Generate JSON orphan report
if: always()
run: |
python3 scripts/docs-orphan-check.py \
--format json \
--output /tmp/docs-orphan-check.json \
--quiet
continue-on-error: true
- name: Upload orphan-check reports
if: always()
uses: actions/upload-artifact@v4
with:
name: docs-orphan-check-${{ github.run_number }}
path: |
/tmp/docs-orphan-check.txt
/tmp/docs-orphan-check.json
retention-days: 30
if-no-files-found: ignore
- name: Write job summary
if: always()
run: |
{
echo "## Docs Orphan Check"
echo ""
echo "| Parameter | Value |"
echo "|-----------|-------|"
echo "| **Script** | \`scripts/docs-orphan-check.py\` |"
echo "| **Docs roots** | \`docs/de\`, \`docs/en\` |"
echo "| **Event** | \`${{ github.event_name }}\` |"
echo "| **Branch** | \`${{ github.ref_name }}\` |"
if [ -f /tmp/docs-orphan-check.json ]; then
CODE=$(python3 -c "import json; d=json.load(open('/tmp/docs-orphan-check.json')); print(d['summary']['code_modules'])" 2>/dev/null || echo "n/a")
DIRS=$(python3 -c "import json; d=json.load(open('/tmp/docs-orphan-check.json')); print(d['summary']['module_docs_dirs'])" 2>/dev/null || echo "n/a")
ORPHANS=$(python3 -c "import json; d=json.load(open('/tmp/docs-orphan-check.json')); print(d['summary']['orphan_module_dirs'])" 2>/dev/null || echo "n/a")
BROKEN=$(python3 -c "import json; d=json.load(open('/tmp/docs-orphan-check.json')); print(d['summary']['broken_primary_references'])" 2>/dev/null || echo "n/a")
echo "| **Code modules** | ${CODE} |"
echo "| **Module doc dirs** | ${DIRS} |"
echo "| **Orphan dirs** | ${ORPHANS} |"
echo "| **Broken references** | ${BROKEN} |"
fi
echo ""
if [ -f /tmp/docs-orphan-check.txt ]; then
echo "**Text Report:**"
echo '```'
cat /tmp/docs-orphan-check.txt
echo '```'
fi
} >> "$GITHUB_STEP_SUMMARY"