Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

schedule

schedule #1318

Workflow file for this run

name: schedule
# 任务触发
on:
# 当 提交到当前仓库时立即运行
push:
branches: [ main ]
schedule:
# UTC 01:00 和 UTC 04:00
- cron: '0 1,4 * * *'
# 当star当前仓库时立即执行
watch:
types: [started]
jobs:
# 自动打卡任务
autocard:
# 使用ubuntu作为运行的OS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
#上游同步
- name: Sync with upstream
if: github.repository != 'GCS-ZHN/AutoCard'
continue-on-error: true
uses: aormsby/[email protected]
with:
upstream_sync_repo: GCS-ZHN/AutoCard
upstream_sync_branch: main
target_sync_branch: main
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
upstream_pull_args: '-s recursive -Xtheirs'
# 安装java环境
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: "maven"
- name: "Build with maven"
run: "mvn clean package spring-boot:repackage"
- name: "Configure file"
run: "rm -rf config && mv action/config config && mv target/autocard*jar autocard.jar"
# 缓存信息,当缓存发生变化时,请修改key值
- name: "Cache autocard cache file"
uses: actions/cache@v3
with:
key: autocard_cache-${{ secrets.AUTOCARD_CACHE_FLAG }}
path: "autocard_cache.json"
# 执行打卡
- name: "Run AutoCard"
env:
AUTOCARD_USER: ${{ secrets.AUTOCARD_USER }}
AUTOCARD_PWD: ${{ secrets.AUTOCARD_PWD }}
AUTOCARD_DINGTALK_URL: ${{ secrets.AUTOCARD_DINGTALK_URL }}
AUTOCARD_DINGTALK_SECRET: ${{ secrets.AUTOCARD_DINGTALK_SECRET }}
AUTOCARD_MAX_TRIAL: ${{ secrets.AUTOCARD_MAX_TRIAL }}
AUTOCARD_NICKNAME: ${{ secrets.AUTOCARD_NICKNAME }}
run: "java --add-opens java.base/java.lang=ALL-UNNAMED -jar autocard.jar --app.autoCard.immediate=true"