Skip to content

updating version

updating version #33

Workflow file for this run

name: FOOPS badge to gh-pages
on:
push:
branches: [main]
workflow_dispatch:
jobs:
foops:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Call FOOPS! API
run: |
curl -X POST "https://foops.linkeddata.es/assessOntology" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"ontologyUri\": \"https://w3id.org/sulo/\"}" -o foops-results.json
- name: Process & make badge
run: |
python3 - << 'PY'
import json, pathlib
d=json.load(open("foops-results.json"))
tot=sum(c["total_tests_run"] for c in d["checks"])
pas=sum(c["total_passed_tests"] for c in d["checks"])
pct = (pas / tot * 100) if tot else 0
label = f"{pct:.0f}% ({pas}/{tot} tests)"
svg=f'''<svg xmlns="http://www.w3.org/2000/svg" height="20" width="200" role="img" aria-label="FOOPS {label}">
<rect width="200" height="20" fill="#555"/>
<rect x="60" width="140" height="20" fill="#4c1"/>
<g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva" font-size="11">
<text x="5" y="14">FOOPS!</text>
<text x="130" y="14" text-anchor="middle">{label}</text>
</g>
</svg>'''
out=pathlib.Path("foops"); out.mkdir(parents=True, exist_ok=True)
open(out/"foops-badge.svg","w").write(svg)
open(out/"foops-results.json","w").write(json.dumps(d, indent=2))
PY
- name: Publish to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./foops
destination_dir: foops
keep_files: true