TorCroft / gatepasscode

郑州大学主校区入校通行码。ZZU Gate Passcode.

Home Page:https://torcroft.github.io/gatepasscode/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gatepasscode

郑州大学主校区入校通行码,适配北门、东门、南门。

Update

作者毕业了,该项目停止维护。访客页面未经验证,谨慎使用。

本人其他相关项目

预览

Website Preview

Usage

  • 创建一个空仓库

  • 添加名为UID_PWD的secrets变量。定位到Settings -> Secrets and variables -> Actions,选择New repository secret(绿色的按钮)。UID_PWD:账号密码都是健康打卡平台的,将你的账号密码使用&拼接起来。
    Exp: 你的账号是123456789,密码是password,那么UID_PWD的值应该是123456789&password,密码默认是身份证后八位。用于Python脚本爬取新的通行码图片。
    Secrets Example

  • 使用 Github Action 来部署静态HTML网页。定位到 Settings -> Pages,在 Build and deployment 一栏中,Source 选择Github Actions,然后选择Static HTML,然后会自动为你添加一个Workflow(yml文件)。
    Page Example
    要指定的yml设置为如下内容

name: Deploy GatePasscode

on:
  workflow_dispatch:

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build:
    runs-on: ubuntu-latest
    permissions: write-all
    outputs:
      status: ${{ steps.pyscripts.conclusion }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Python 3.12
        uses: actions/setup-python@v5
        with:
          python-version: 3.12

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          git clone --depth 1 https://github.com/TorCroft/gatepasscode.git
          requirements_file="./gatepasscode/requirements.txt"
          if [ -f $requirements_file ]; then pip install -r $requirements_file; fi

      - name: Run Python Script
        id: pyscripts
        env:
          UID_PWD: ${{ secrets.UID_PWD }}
        run: |
          cd gatepasscode
          python ./index.py >> $GITHUB_STEP_SUMMARY

      - name: Setup Pages
        if: steps.pyscripts.conclusion == 'success'
        uses: actions/configure-pages@v5

      - name: Upload artifact
        if: steps.pyscripts.conclusion == 'success'
        uses: actions/upload-pages-artifact@v3
        with:
          path: "./gatepasscode/page"

  deploy:
    needs: build
    if: needs.build.outputs.status == 'success'
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

注意

  • GitHub Action的触发器中不再包含定时器,本人只在需要时运行Action更新通行码图片。iOS可使用Shortcuts APP,利用API触发。这里给出示例 API触发Workflow ,示例中包含使用Python和Shortcuts请求API触发Workflow。
  • 如需要定时器,请自行在 Workflow 中的on添加以下代码
  schedule:
    - cron: '0 20 * * *'

修改后为

on:
  # 手动触发入口
  workflow_dispatch:
  # 定时器,UTC时间每天的20:00
  schedule:
    - cron: '0 20 * * *'

About

郑州大学主校区入校通行码。ZZU Gate Passcode.

https://torcroft.github.io/gatepasscode/

License:MIT License


Languages

Language:HTML 69.0%Language:Python 31.0%