This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 247
68 lines (57 loc) · 2.1 KB
/
schedule.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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"