| 1 | #!/usr/bin/env bash |
| 2 | # Reads a Deploy job's log on stdin and prints what the sync repeats on GitHub: the warnings the |
| 3 | # deploy raised, as workflow commands, and its lines about Turnstile and Cloudflare Access. A |
| 4 | # step's log starts with its script, so a line only counts where the runner wrote it (after the |
| 5 | # timestamp), never where the script's text says `echo "::warning::..."`. |
| 6 | set -uo pipefail |
| 7 | log=$(cat) |
| 8 | ts='^([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9:.]+Z )?' |
| 9 | sed -nE "s/${ts}(##\[warning\]|::warning[^:]*::)//p" <<<"$log" | head -n 40 | while IFS= read -r w; do |
| 10 | echo "::warning::Diffinery Deploy: $w" |
| 11 | done |
| 12 | # Site keys are public; the secret key is never printed. |
| 13 | grep -E "${ts}(Turnstile widget|TURNSTILE_SECRET|site key:|/security/report|/auth/access)" <<<"$log" \ |
| 14 | | grep -vE "${ts}(##\[|::)|\\\$|echo " | head -n 10 | sed 's/^/ deploy: /' |
| 15 | exit 0 |