|
| 1 | +name: Provider favicon refinement once |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - '.github/workflows/provider-favicon-refinement-once.yml' |
| 8 | + - 'scripts/refine_provider_logos_from_favicons_once.py' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + issues: write |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: niakvio-provider-favicon-refinement-once |
| 17 | + cancel-in-progress: false |
| 18 | + |
| 19 | +jobs: |
| 20 | + refine-once: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 30 |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 25 | + with: |
| 26 | + ref: main |
| 27 | + fetch-depth: 0 |
| 28 | + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 |
| 29 | + with: |
| 30 | + python-version: '3.12' |
| 31 | + - name: Install one-shot image dependencies |
| 32 | + run: python -m pip install --disable-pip-version-check --no-cache-dir 'Pillow==11.3.0' 'CairoSVG==2.8.2' |
| 33 | + - name: Prefer readable provider site icons |
| 34 | + run: python scripts/refine_provider_logos_from_favicons_once.py |
| 35 | + - name: Verify committed logo inventory |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + set -euo pipefail |
| 39 | + python - <<'PY' |
| 40 | + import json |
| 41 | + from pathlib import Path |
| 42 | + from PIL import Image |
| 43 | + root=Path('.') |
| 44 | + index=json.loads((root/'assets/providers/index.json').read_text(encoding='utf-8')) |
| 45 | + manifest=json.loads((root/'manifest.json').read_text(encoding='utf-8')) |
| 46 | + enabled=[r for r in manifest.get('scrapers',[]) if isinstance(r,dict) and r.get('enabled') is not False] |
| 47 | + providers=index.get('providers') or {} |
| 48 | + missing=[str(r.get('id')).casefold() for r in enabled if str(r.get('id')).casefold() not in providers] |
| 49 | + assert not missing, missing |
| 50 | + for provider_id,row in providers.items(): |
| 51 | + for key,size in {'72x32':(72,32),'96x40':(96,40)}.items(): |
| 52 | + path=root/row['assets'][key] |
| 53 | + assert path.is_file(), (provider_id,path) |
| 54 | + with Image.open(path) as image: |
| 55 | + assert image.format == 'WEBP', (provider_id,key,image.format) |
| 56 | + assert image.size == size, (provider_id,key,image.size) |
| 57 | + print(f"FIELD_PROVIDER_LOGO_ASSET_QA indexed={len(providers)} active={len(enabled)} missing_active=0") |
| 58 | + PY |
| 59 | + - name: Commit refined assets and remove one-shot machinery |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + set -euo pipefail |
| 63 | + rm -f scripts/refine_provider_logos_from_favicons_once.py .github/workflows/provider-favicon-refinement-once.yml |
| 64 | + git config user.name 'github-actions[bot]' |
| 65 | + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' |
| 66 | + git add -A |
| 67 | + if git diff --cached --quiet; then |
| 68 | + echo 'No favicon refinement changed committed assets.' |
| 69 | + exit 0 |
| 70 | + fi |
| 71 | + git commit -m 'assets: refine provider logos for small displays' |
| 72 | + git fetch origin main |
| 73 | + git rebase origin/main |
| 74 | + git push origin HEAD:main |
| 75 | + - name: Report completion |
| 76 | + env: |
| 77 | + GH_TOKEN: ${{ github.token }} |
| 78 | + run: gh issue comment 69 --repo "$GITHUB_REPOSITORY" --body "Provider favicon refinement completed once: site/app icons were preferred where they are more legible at Nuvio sizes; committed WebP assets remain the only runtime source. One-shot refinement code removed." |
0 commit comments