Files
vuln-status/.gitea/workflows/update-status.yml
T

31 lines
1.2 KiB
YAML

name: Vulnerability Status Dashboard
on:
workflow_dispatch:
schedule:
- cron: '*/15 * * * *'
jobs:
update:
runs-on: status
steps:
- name: Dashboard aktualisieren
env:
GITEA_URL: ${{ gitea.server_url }}
GITEA_API_TOKEN: ${{ secrets.STATUS_API_TOKEN }}
STATUS_REPOSITORY: vuln-status
STATUS_OWNER: VULN
run: |
python --version
python - <<'PY'
import base64, json, os, urllib.request
# Read script via authenticated Gitea raw-content API if the repository is private.
# Use contents API instead for consistent authentication across versions.
api = os.environ['GITEA_URL'].rstrip('/') + '/api/v1/repos/' + os.environ['STATUS_OWNER'] + '/' + os.environ['STATUS_REPOSITORY'] + '/contents/'
req = urllib.request.Request(api + 'scripts/update_status.py?ref=main',headers={'Authorization':'token '+os.environ['GITEA_API_TOKEN']})
with urllib.request.urlopen(req,timeout=30) as resp:
payload=json.load(resp)
code=base64.b64decode(payload['content']).decode('utf-8')
exec(compile(code,'update_status.py','exec'),{'__name__':'__main__'})
PY