Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/update-driverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Update driverless printer list

on:
schedule:
# Monthly, 1st of the month at 06:00 UTC
- cron: '0 6 1 * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

# A manual run must not overlap a scheduled one mid-PR.
concurrency:
group: "update-driverless"
cancel-in-progress: false

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# The script must run from driverless/: it reads ./convert-airprint.py and
# ./add-ippeve-only.py and writes ../public/assets/json/driverless.json.
- name: Update printer list
working-directory: driverless
run: ./update-printer-list.sh

# Guard against an empty/garbled list slipping through (#223). The script
# has no `set -e`, so a failed upstream fetch can still exit 0 with a
# truncated file; fail the run before any PR is opened.
- name: Validate updated list
run: |
python3 - <<'PY'
import json, sys
try:
with open('public/assets/json/driverless.json') as f:
data = json.load(f)
except Exception as e:
print(f'::error::driverless.json is not valid JSON ({e}). Aborting.')
sys.exit(1)
if not isinstance(data, list):
print(f'::error::driverless.json must be a JSON array, got {type(data).__name__}. Aborting.')
sys.exit(1)
count = 0
for p in data:
if not isinstance(p, dict) or 'model' not in p:
print(f'::error::driverless.json contains a malformed entry: {p!r}. Aborting.')
sys.exit(1)
if p['model'] != '_dummy_':
count += 1
print(f'Driverless printers: {count}')
if count < 5000:
print(f'::error::driverless.json has only {count} printers; expected thousands. Aborting.')
sys.exit(1)
PY

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: public/assets/json/driverless.json
branch: update-driverless-list
delete-branch: true
commit-message: "Update driverless printer list"
title: "Update driverless printer list"
body: |
Automated monthly update of the driverless (AirPrint + IPP Everywhere)
printer list, generated by `driverless/update-printer-list.sh`.
Loading