2018-09-22 22:07:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Continuous integration script to check that TODOs are in the correct format
|
2021-03-24 19:57:27 +00:00
|
|
|
OUTPUT="$(grep -PrinH '(?<!context\.)todo(?!\(#{0,1}\d+\))' --include ./**/*.go --exclude ./*site_data.go --exclude ./*mainnet_config.go)";
|
2018-09-22 22:07:03 +00:00
|
|
|
if [ "$OUTPUT" != "" ] ;
|
2021-03-24 19:57:27 +00:00
|
|
|
then
|
2018-09-22 22:07:03 +00:00
|
|
|
echo "Invalid TODOs found. Failing." >&2;
|
|
|
|
echo "$OUTPUT" >&2;
|
|
|
|
exit 1;
|
2021-03-24 19:57:27 +00:00
|
|
|
fi
|
2018-10-11 18:52:09 +00:00
|
|
|
|
2021-03-24 19:57:27 +00:00
|
|
|
while read -r line ; do
|
|
|
|
linenum=$(expr "$line" : '^\([0-9]*:\)')
|
2018-10-11 18:52:09 +00:00
|
|
|
issueNum=${line//$linenum}
|
2021-03-24 19:57:27 +00:00
|
|
|
issueState=$(curl https://api.github.com/repos/prysmaticlabs/prysm/issues/"$issueNum" | grep -o '"state":"closed"');
|
2018-10-11 18:52:09 +00:00
|
|
|
|
|
|
|
if [ "$issueState" != "" ];
|
2021-03-24 19:57:27 +00:00
|
|
|
then
|
2018-10-11 18:52:09 +00:00
|
|
|
echo "Issue referenced has already been closed" >&2;
|
|
|
|
echo "Issue Number: $issueNum" >&2;
|
|
|
|
exit 1;
|
2018-09-22 22:07:03 +00:00
|
|
|
fi
|
2021-03-24 19:57:27 +00:00
|
|
|
done < <(grep -PrinH -o -h '(?<!context\.)todo\(#{0,1}\K(\d+)' --include ./*.go)
|