22 lines
1.0 KiB
YAML
22 lines
1.0 KiB
YAML
name: diagnose-hotspot-access
|
|
on:
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
diagnose:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Production diagnosis and database write check
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
docker inspect pix-hotspot --format 'IMAGE={{.Config.Image}} PORTS={{json .NetworkSettings.Ports}}'
|
|
docker exec -i pix-hotspot node --input-type=module < backend/diagnose-hotspot.mjs
|
|
- name: Recent sanitized errors
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
docker logs --since 2h --tail 3000 pix-hotspot 2>&1 | node -e 'let s="";process.stdin.on("data",x=>s+=x);process.stdin.on("end",()=>console.log(s.split("\n").filter(l=>/\[(ACESSO|CHECKOUT|LIMPEZA|HTTP)/.test(l)).slice(-60).map(l=>l.replace(/(?:[0-9a-f]{2}:){5}[0-9a-f]{2}/gi,"[MAC]").replace(/(?:\d{1,3}\.){3}\d{1,3}/g,"[IP]").replace(/(?:APP_USR|TEST)-[\w-]+/g,"[TOKEN]").replace(/[\w.+-]+@[\w.-]+\.[A-Za-z]{2,}/g,"[EMAIL]").slice(0,700)).join("\n")));'
|