How aoi-cn/jksb-sysu works
Main Components
a. GitHub Actions Workflow:
• Component: .github/workflows/jksb.yml
• Role: Acts as the scheduler; triggers the Python script execution based on a cron schedule. It separates deployment configuration and scheduling from the business logic.
b. Python Automation Scripts:
• Components: jksb_sysu.py and util.py
• Role: jksb_sysu.py contains the core automation logic that logs in to the SYSU authentication system, reuses previous submission data, and submits the health report. util.py likely contains helper functions such as email sending or OCR-related utilities.
c. External Dependencies and Technologies:
• Selenium: Automates browser interactions.
• Firefox: Browser used by Selenium, potentially in headless mode.
• ddddocr: Provides OCR functionality to possibly handle any image captcha challenges.
• geckodriver.exe: The driver used by Selenium to control Firefox (note the presence of a Windows executable).
• Email Service: Sends the report result as an email. Although the exact email API isn’t detailed, the README indicates that emails are used for notification purposes.
d. Configuration and Secrets:
• GitHub Secrets: NETID and PASSWORD are stored securely in the repository’s Settings.
• requirements.txt: Lists all the Python package dependencies.
• README.md: Contains usage instructions, scheduling configuration, and workflow details.
Relationships and Data Flow
• The GitHub Actions scheduler (jksb.yml) triggers the workflow based on a predefined cron schedule.
• Once triggered, the GitHub runner loads the Python environment and executes the main script (jksb_sysu.py).
• The Python script retrieves sensitive credentials (NETID and PASSWORD) from GitHub Secrets, logs into the Central Identity Authentication Service of SYSU, and submits the health report.
• The script reuses data from the previous submission, ensuring minimal user intervention.
• After submission, the script uses email notification to send the report result. The email sending logic is likely encapsulated in util.py.
• External dependencies (Selenium + Firefox + ddddocr) are utilized within the Python script to navigate the web interface and solve any OCR challenges.
Architectural Patterns and Design Principles
• The project follows a separation of concerns: Workflow scheduling is isolated from the application logic (the Python code).
• It uses external configuration (GitHub Secrets) to handle sensitive data.
• The design leverages automation patterns, particularly “cron-job as a service” via GitHub Actions, eliminating the need for dedicated servers.
• GitHub Repository (with file tree elements such as README, .github/workflows, jksb_sysu.py, util.py, requirements.txt)
• GitHub Actions Workflow (Scheduled via cron; initiates automation)
• Python Automation Engine (jksb_sysu.py + util.py)
• Dependencies: Selenium, Firefox, ddddocr, geckodriver.exe
• Uses credentials via GitHub Secrets (NETID, PASSWORD)
• External Systems:
• SYSU Central Identity Authentication Service (for login and report submission)
• Email Service/Notification System (sends report results to user)