Update check PR workflow

revert-4113-patch-1
Ivanq 4 years ago
parent 50c172af5d
commit c6fa0412e4
  1. 9
      .github/workflows/check-pr.yml
  2. 16
      check-signatures-format.py

@ -1,13 +1,14 @@
name: Do not modify index.md directly, add a file to _data/signed instead name: Check signatures format
on: on:
pull_request: pull_request:
branches: branches:
- master - master
paths: paths:
- index.md - _data/signed/*
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Throw error - uses: actions/checkout@v2
run: echo "Do not modify index.md directly, add a file to _data/signed instead"; exit 1 - 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…
Cancel
Save