Skip to content

Commit 02413c8

Browse files
committed
ci: add GitHub Actions workflowautomated sync
1 parent 2a4b23d commit 02413c8

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/sync.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: LeetCode Sync
2+
3+
on:
4+
workflow_dispatch:
5+
6+
schedule:
7+
- cron: "0 */6 * * *" # Every 6 hours
8+
9+
jobs:
10+
sync:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.13"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
29+
- name: Run LeetCode Sync
30+
env:
31+
LEETCODE_SESSION: ${{ secrets.LEETCODE_SESSION }}
32+
CSRF_TOKEN: ${{ secrets.CSRF_TOKEN }}
33+
LEETCODE_USERNAME: ${{ secrets.LEETCODE_USERNAME }}
34+
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
35+
GITHUB_EMAIL: ${{ secrets.GITHUB_EMAIL }}
36+
37+
run: |
38+
python main.py
39+
40+
- name: Push changes
41+
run: |
42+
git config --global user.name "${{ secrets.GITHUB_USERNAME }}"
43+
git config --global user.email "${{ secrets.GITHUB_EMAIL }}"
44+
45+
git push

0 commit comments

Comments
 (0)