parent
50c172af5d
commit
c6fa0412e4
@ -1,13 +1,14 @@ |
||||
name: Do not modify index.md directly, add a file to _data/signed instead |
||||
name: Check signatures format |
||||
on: |
||||
pull_request: |
||||
branches: |
||||
- master |
||||
paths: |
||||
- index.md |
||||
- _data/signed/* |
||||
jobs: |
||||
deploy: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- name: Throw error |
||||
run: echo "Do not modify index.md directly, add a file to _data/signed instead"; exit 1 |
||||
- uses: actions/checkout@v2 |
||||
- name: Check signatures format |
||||
run: python3 check-signatures-format.py |
||||
|
@ -0,0 +1,16 @@ |
||||
import os |
||||
import re |
||||
|
||||
|
||||
regex = re.compile(r"name: (\S+\s)*\S+\nlink: (/#|(https?://|mailto:)[a-zA-Z0-9_().@:%\+~#?&//=-]+)\n{,2}") |
||||
|
||||
ok = True |
||||
for file_name in sorted(os.listdir("_data/signed")): |
||||
with open(f"_data/signed/{file_name}") as f: |
||||
contents = f.read() |
||||
if not re.fullmatch(regex, contents): |
||||
print(file_name, "has invalid format") |
||||
ok = False |
||||
|
||||
if not ok: |
||||
raise SystemExit(1) |
Loading…
Reference in new issue