Skip to content

Add cron workflow to update driverless printer list - #234

Open
hissamshar wants to merge 2 commits into
OpenPrinting:masterfrom
hissamshar:master
Open

Add cron workflow to update driverless printer list#234
hissamshar wants to merge 2 commits into
OpenPrinting:masterfrom
hissamshar:master

Conversation

@hissamshar

Copy link
Copy Markdown
Contributor

Fixes #229.

Adds a scheduled GitHub Actions workflow that keeps the driverless (AirPrint +
IPP Everywhere) printer list up to date automatically, instead of relying on
manual runs.

  • Runs driverless/update-printer-list.sh on the 1st of each month
    (cron: '0 6 1 * *'), with a workflow_dispatch trigger for manual runs.
  • Opens a pull request with any changes via peter-evans/create-pull-request@v8,
    scoped to public/assets/json/driverless.json.
  • Adds a validation step that checks the JSON is valid and still contains a
    plausible number of printers before opening a PR, so an upstream failure can't
    empty the list again (see No Driverless Printers? #223).

The auto-opened PR uses the default GITHUB_TOKEN and therefore won't run the
build.yml checks; merging still triggers the Pages deploy.

Copilot AI lite review requested due to automatic review settings August 18, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Finding(s):

  • The validation step can fail with an unhelpful Python traceback if driverless.json is valid JSON but not an array of objects; adding explicit shape checks would make failures consistently produce the intended ::error::… annotations.

This PR adds a GitHub Actions workflow to automatically refresh the site’s driverless printer dataset on a monthly schedule (and on manual dispatch), creating a PR for changes to the generated JSON. This fits the repo’s static-site workflow by keeping public/assets/json/driverless.json updated without manual intervention.

Changes:

  • Add a scheduled (cron: '0 6 1 * *') + manual (workflow_dispatch) workflow to run driverless/update-printer-list.sh.
  • Validate the updated JSON and enforce a minimum “plausible” printer count before opening a PR.
  • Auto-open/update a PR limited to public/assets/json/driverless.json via peter-evans/create-pull-request@v8.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +37 to +50
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)
count = sum(1 for p in data if p.get('model') != '_dummy_')
print(f'Driverless printers: {count}')
if count < 5000:
print(f'::error::driverless.json has only {count} printers; expected thousands. Aborting.')
sys.exit(1)
PY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GitHub workflow, cron-based to update driverless (AirPrint, IPP Everywhere) printer list

2 participants