-
Notifications
You must be signed in to change notification settings - Fork 43
59 lines (49 loc) · 1.4 KB
/
data-refresh.yaml
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
name: automatic-data-update
on:
schedule:
# Runs at 1 PM UTC, which is 6:30 PM IST
- cron: '*/15 * * * *'
jobs:
automatic-data-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Create and start virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
python -m pip install -U uv
uv pip install -r requirements.txt
- name: Data Refresh...
run: python leetcomp/refresh.py
- name: Parsing Data...
run: python leetcomp/parse.py
- name: Commit files
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git add .
git commit -m "action: daily data refresh"
git push
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'Automatic Data Update',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'Automatic LeetCode data update',
]
});