Skip to content

Commit fc93cf3

Browse files
chore(ci): scaffolding
1 parent f2cafc1 commit fc93cf3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/scaffolding.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Scaffold LeetCode Problems
2+
3+
on:
4+
push:
5+
paths:
6+
- "scripts/*.json"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
scaffold:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install requests
28+
29+
- name: Commit scaffolding
30+
shell: bash
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
35+
for f in scripts/*.json; do
36+
[[ "$f" == *details.json ]] && continue
37+
python scripts/scaffolding.py "$f"
38+
39+
json_name=$(basename "$f" .json)
40+
41+
git add "scripts/${json_name}-details.json"
42+
git add problems/
43+
44+
if ! git diff --cached --quiet; then
45+
git commit -m "chore(${json_name}): scaffolding"
46+
fi
47+
done
48+
49+
- name: Push
50+
run: git push

0 commit comments

Comments
 (0)