Skip to content

Commit

Permalink
Merge pull request Bruuuuuuce#39 from ErnestDong/main
Browse files Browse the repository at this point in the history
增加 github actions
  • Loading branch information
Bruuuuuuce authored Nov 15, 2021
2 parents 7f5ebb0 + aca5c50 commit a6a8177
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Python Package using Conda

on:
schedule:
- cron: "0 */4 * * *"
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
pip3 install selenium==3.8.0
- name: generate config.ini
run:
python3 actions.py -u ${{ secrets.STUDENTNUM }} -p ${{ secrets.PASSWD }}
- name: main
run:
python3 main.py
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ PKU一键出入校备案小工具 v3.1 (2021.11.6)
为作者的第一个 `selenium` 练手小项目,完善程度较低,欢迎任意类型的使用与开发改进


### 利用 GitHub Actions 自动运行
fork 本仓库后,在 [config.sample.ini](config.sample.ini) 中修改除学号密码以外的参数

**Note:** 本项目的[GitHub Actions 自动运行版本](https://github.com/YOUSIKI/PKUAutoSubmit-action),膜 YOUSIKI 大佬

然后在自己仓库的 settings->secrets->New repository secret 中新建 Name 为 STUDENTNUM, Value 为学号;Name 为 passwd,Value为密码

默认每天晚上0点起每四个小时跑一次,可能会运行失败。
## 说明

- 本工具采用 Python3 搭配 `selenium` 完成自动化操作,实现全自动填报学生出入校备案,为频繁出入校的 PKU 学子(不频繁也行)提供较为便捷的解决方案
Expand Down
14 changes: 14 additions & 0 deletions actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from configparser import ConfigParser
import argparse

cfg = ConfigParser()
cfg.read("config.sample.ini")

parser = argparse.ArgumentParser(description="generate config.ini")

parser.add_argument("-u", type=str, help="学号")
parser.add_argument("-p", type=str, help="密码")
args = parser.parse_args()
cfg.set("login", "username", args.u)
cfg.set("login", "password", args.p)
cfg.write(open("config.ini", "w"))

0 comments on commit a6a8177

Please sign in to comment.