authors-rst.py: add support for printing errors in GitHub actions format

develop
lethosor 2020-07-01 21:58:54 -04:00
parent 20993f9a42
commit 142a7aa287
1 changed files with 3 additions and 1 deletions

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" Overly-complicated script to check formatting/sorting in Authors.rst """ """ Overly-complicated script to check formatting/sorting in Authors.rst """
import re, sys import os, re, sys
def main(): def main():
success = [True] success = [True]
@ -10,6 +10,8 @@ def main():
for k in kwargs: for k in kwargs:
info += ' %s %s:' % (k, kwargs[k]) info += ' %s %s:' % (k, kwargs[k])
print('line %i:%s %s' % (line, info, msg)) print('line %i:%s %s' % (line, info, msg))
if os.environ.get('GITHUB_ACTIONS'):
print('::error file=docs/Authors.rst,line=%i::%s %s' % (line, info.lstrip(), msg))
success[0] = False success[0] = False
with open('docs/Authors.rst', 'rb') as f: with open('docs/Authors.rst', 'rb') as f:
lines = list(map(lambda line: line.decode('utf8').replace('\n', ''), f.readlines())) lines = list(map(lambda line: line.decode('utf8').replace('\n', ''), f.readlines()))