-
Notifications
You must be signed in to change notification settings - Fork 11
136 lines (121 loc) · 3.45 KB
/
daily_check.yml
File metadata and controls
136 lines (121 loc) · 3.45 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: LeetCode Submit Checker
on:
workflow_dispatch: # manually trigger
schedule:
- cron: '0 14 * * *' # run every day at midnight
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
cpp
golang
python
qubhjava
typescript
rust
go.mod
go.sum
pom.xml
MODULE.bazel
tsconfig.json
package.json
jest.config.ts
Cargo.toml
data
${{ secrets.PROBLEM_FOLDER || 'problems' }}
${{ secrets.PREMIUM_FOLDER || 'premiums' }}
daily-${{ secrets.PROBLEM_FOLDER || 'problems' }}.json
BUILD
extensions.bzl
solutions.bzl
get_daily_path.py
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: '3.14'
- name: Set up Golang environment
continue-on-error: true
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Set up JDK
continue-on-error: true
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up TypeScript
continue-on-error: true
run: |
npm install
- name: Set up rust-cargo
continue-on-error: true
uses: actions-rs/cargo@v1.0.1
with:
command: check
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r python/requirements.txt
- name: Build with Maven
continue-on-error: true
run: |
mvn clean validate
- name: Setup Bazel
continue-on-error: true
uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
bazelrc: |
build --color=yes
build --show_timestamps
build --cxxopt=-std=c++23
test --cxxopt=-std=c++23
- name: Run script
env:
COOKIE: ${{ secrets.COOKIE || '' }}
PUSH_SERVER: ${{ secrets.PUSH_SERVER || '' }}
PUSH_KEY: ${{ secrets.PUSH_KEY || '' }}
PROBLEM_FOLDER: ${{ secrets.PROBLEM_FOLDER || '' }}
LANGUAGES: ${{secrets.LANGUAGES || 'python3'}}
LEETCODE_USER: ${{ secrets.LEETCODE_USER }}
LOG_LEVEL: ${{secrets.LOG_LEVEL || 'INFO'}}
run: |
set +e
python python/scripts/daily_submission.py &> /tmp/msg
status=$?
cat /tmp/msg
exit $status
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "test: [$(TZ=Asia/Shanghai date +%Y%m%d)] Add daily problem solution"
- name: Push changes
run: |
if git log origin/${{ github.ref_name }}..HEAD --oneline | read; then
git push
else
echo "No changes to push"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}