Skip to content

Commit 9eee926

Browse files
committed
Check that all allocations' owner files exist
1 parent 1c5bbac commit 9eee926

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ jobs:
99
- uses: actions/setup-python@v2
1010
with:
1111
python-version: '3.x'
12-
- run: python3 -m test.validate_pids
12+
- run: pip install -r requirements.txt; python3 -m test.validate_pids
1313

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-frontmatter

test/validate_pids.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
import sys
3+
import frontmatter
34

45
existing_0xxx = {'0006', '01C0', '0007', '053A', '0256', '0008', '000F', '0BAB', '0009', '0001', '000A',
56
'0010', '01CB', '000C', '0002', '000E', '0CBD', '000D', '000B', '0003', '0004', '0514',
@@ -42,6 +43,20 @@
4243
ok = False
4344
print("Pid is too long: '" + pid + "'")
4445

46+
try:
47+
post = frontmatter.load(vid_1209 / pid / "index.md")
48+
owner = post.get('owner')
49+
if owner is None:
50+
print(f"No owner specified for {pid} @ {vid_1209 / pid / 'index.md'}")
51+
ok = False
52+
continue
53+
owner_path = Path("org") / owner / "index.md"
54+
if not owner_path.exists():
55+
print(f"Owner file {owner} for pid {pid} does not exist")
56+
ok = False
57+
except Exception as e:
58+
print(f"Failure parsing front matter for {pid}: {e}")
59+
ok = False
4560
if pid1xxx - existing_1xxx:
4661
print("Cannot claim 1xxx PID:", pid1xxx - existing_1xxx)
4762
print("See here for more info: http://pid.codes/1209/")
@@ -54,6 +69,7 @@
5469

5570

5671
if not ok:
72+
print("Error(s) found")
5773
sys.exit(-1)
5874

5975
print("No errors found!")

0 commit comments

Comments
 (0)