How saikumar-bali/erp_automation_bot works
Project type and purpose
• This is an automation tool (ERP Attendance Automation Bot) written in Python.
• Its goal is to automate employee check-in/check-out on an ERP portal by programmatically driving a headless browser, handling credentials, simulating geolocation, producing proof screenshots, and logging results.
• It supports local execution (via PowerShell) and cloud scheduling (via GitHub Actions).
File structure
• Top-level:
• .github/workflows/scheduled-attendance.yml – GitHub Actions workflow for scheduled runs.
• scripts/run_silent.ps1 – PowerShell wrapper to launch the Python script silently on Windows.
• src/auto_attendance.py – Main Python automation engine (uses Playwright).
• config.json – Local config store for credentials, URLs, headless flag, geo-coords.
• logs/ – Generated logs and screenshots.
• .gitignore – Excludes logs/, sensitive files.
• Patterns: single-process automation engine, external scheduling layers, separation of config from code.
Key README insights
• Credentials are stored in config.json locally or injected as environment variables in GitHub Actions.
• Two scheduling modes:
a) Windows Task Scheduler → calls run_silent.ps1.
b) GitHub Actions → cron job at 8:30 AM UTC, uses repository secrets, uploads artifacts (logs/screenshots), sends notifications on failure.
• Dependencies: Python ≥3.7, Playwright+Chromium, Windows OS for PowerShell scheduling.
1. Scheduler Layer
• Windows Task Scheduler
• GitHub Actions Runner
2. Execution Engine
• PowerShell Wrapper (scripts/run_silent.ps1)
• Python Script (src/auto_attendance.py)
• Playwright + Chromium Headless Browser
3. Configuration Store
• Local config.json
• GitHub Actions Secrets → environment variables
4. External Service
• ERP Web Portal (login URL, checkin URL)
5. Storage & Output
• Local logs/ directory (attendance_log.txt, proof_*.png, error_state.png)
• GitHub Actions Artifacts
6. Notifications (Failures via GitHub Actions or Windows notifications)
• Scheduler → invokes PowerShell wrapper / GitHub runner
• Wrapper → launches Python engine with headless Chromium
• Engine → reads config (file or env vars)
• Engine → authenticates & interacts with ERP portal over HTTPS
• Engine → writes logs/screenshots to local disk
• GitHub Actions → collects logs/screenshots as artifacts & triggers notifications on failure
c. Architectural patterns & principles:
• Single Responsibility: separate scheduling, execution, config, storage
• Configuration-as-code: config.json for local, secrets for CI
• Headless browser automation pattern (Playwright driving Chromium)
• Decoupled scheduling: two independent schedulers (local OS, cloud CI)
d. Key technologies/frameworks:
• Python 3.7+
• Playwright (with Chromium)
• PowerShell (Windows scheduling)
• GitHub Actions (YAML workflow, secrets, cron triggers)
• Windows Task Scheduler (alternative local execution)