Minimal GitHub action for BUAA NCOV daily report.
Only 2 steps needed:
-
Creating a repository by
Use this template
: See Creating a repository from a template for details. -
Creating encrypted secrets: See Creating encrypted secrets for a repository for details.
You should create two secrets:
USERNAME
: your BUAA SSO usernamePASSWORD
: your BUAA SSO password
buaa-ncov-report-action
uses python-requests to report.
-
Login
# login login = s.post(url='https://app.buaa.edu.cn/uc/wap/login/check', data={ 'username': os.environ['USERNAME'], 'password': os.environ['PASSWORD'] }, headers=header)
-
Getting yesterday's info
# get info info = s.get(url='https://app.buaa.edu.cn/buaaxsncov/wap/default/get-info', headers=header)
-
Report
# report report = s.post(url='https://app.buaa.edu.cn/buaaxsncov/wap/default/save', data=json.loads(info.text)['d']['oldInfo'], headers=header)
buaa-ncov-report-action
uses GitHub Action to trigger report.py
.
report.yml
schedules a workflow to run at specific UTC times(9:00 UTC) using POSIX cron syntax:
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * *'
Since GitHub will send an email notification of workflow error messages to you when workflow fails, buaa-ncov-report-action
does not implement another way for notification.
You can run workflow by yourself and view log at here.
Feel free to open an issue if you have any questions.
- There is slight difference between the real report data and yesterday's data. Nevertheless, it doesn't matter because I have used this for over 6 months and everything is fine.
- Scheduled workflows will be disabled automatically after 60 days of repository inactivity. See here for details. You will receive an email before the workflow is disabled and you can prevent it from being disabled on workflow page.
buaa-ncov-report-action
released under the MIT license.