Skip to content

hstable/auto-report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-report

Auto daily report for HITSZ Students.

Usage

Report Once

Golang

go run main.go -u your-studentID -p your-password -e your-email

Docker

docker run --rm rocketeerli/auto-report -u your-studentID -p your-password -e your-email

Daily Auto Report

Crontab

  1. You need a server.
  2. Adjust your local timezone.
    timedatectl set-timezone "Asia/Shanghai"
  3. Use crontab -e and append the following line:
    15 8 * * * curl -L -o /tmp/auto-report https://github.com/hstable/auto-report/releases/latest/download/auto-report_linux_amd64 && chmod +x /tmp/auto-report && /tmp/auto-report -u your-studentID -p your-password -e your-email

By default, this program will run at 8:15 a.m. everyday.

Github Action

  1. Fork this repository from here.

  2. Add the repository secrets STUDENTID, PASSWORD and EMAIL in your own repository's Settings-Secrets, which also can be found by Settings-> Secrets -> New repository secret. (Repository secrets are invisible for others.)

  3. Add report.yml file to .github/workflows, and write the following content to this file:

    name: Auto Report
    on: 
      schedule:
        - cron: "15 0 * * *"
      push:
        branches: [main]
    
    jobs:
    
      report:
        name: auto report
        runs-on: ubuntu-latest
        steps:
    
        - name: Build
          run: |
            curl -L -o auto-report https://github.com/hstable/auto-report/releases/latest/download/auto-report_linux_amd64
            chmod +x auto-report
            
        - name: Run
          env:
            STUDENTID: ${{ secrets.STUDENTID }}
            PASSWORD: ${{ secrets.PASSWORD }}
            EMAIL: ${{ secrets.EMAIL }}
          run: |
            if [[ -z $EMAIL ]]
            then ./auto-report -u $STUDENTID -p $PASSWORD
            else ./auto-report -u $STUDENTID -p $PASSWORD -e $EMAIL
            fi

    The time cron above is an UTC time, which is 8 hours slower than Beijing time zone.

    By default, this program will run at 8:15 a.m. everyday.

License

auto-report is licensed by an MIT license as can be found in the LICENSE file.