scripts: act: better debug

We were actually running wget and letting the user see the output...
and get its error code, which is quite fine in a manual run, but
messes with the automatic running of these scripts.

Now, we still do wget and validate its error code, but instead the
script then does its business as usual (and hopefully this fixes our
cron'ed GA).

This patch also changes the time at which the scheduled cronjob runs,
just because it is still once a day, which is what we want, and will
give us still a run today (so we can have it run with this change
sooner rather than later).
This commit is contained in:
Marcos Marado 2021-10-25 11:10:36 +01:00
parent 60f866f9fa
commit 8708cff55d
2 changed files with 5 additions and 4 deletions

View File

@ -2,8 +2,8 @@ name: Validação automática
on:
schedule:
# Every day at 1:00 (AM) UTC
- cron: '0 1 * * *'
# Every day at 11:00 (AM) UTC
- cron: '0 11 * * *'
jobs:
run-validation-scripts:

View File

@ -8,8 +8,9 @@ fi
if [ "$( echo "$content" | grep -i "<img" |grep -v -i alt|wc -l)" -eq "0" ]; then
echo "act: incumprimento pode já não existir";
echo "DEBUG: aqui o output do wget:";
wget -t 1 --no-check-certificate http://www.act.gov.pt/ --user-agent="Mozilla/5.0 Gecko/20100101 Firefox/21.0"
if [ "$(wget -t 1 --no-check-certificate http://www.act.gov.pt/ --user-agent="Mozilla/5.0 Gecko/20100101 Firefox/21.0"; echo $?)" -eq "4" ]; then
echo "[!] o teste falhou: o wget não conseguiu obter o site, por 'Network failure'.";
fi
# TODO: verificar também se o problema com o certiicado ja' esta' resolvido
else
echo "act: Incumprimento mantém-se, a actualizar o README (faça um git diff, valide, e commit!)";