-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) ยท 1.34 KB
/
move-leetcode.yml
File metadata and controls
39 lines (34 loc) ยท 1.34 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
name: Organize LeetCode problems
on:
push:
branches:
- main
permissions:
contents: write
jobs:
organize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Move only LeetCode problem folders
run: |
mkdir -p LeetCode
# ๋ฃจํธ์ ์๋ LeetCode ๋ฌธ์ ํด๋๋ง ์ด๋ (์: 0001-two-sum)
for dir in [0-9][0-9][0-9][0-9]-*; do
if [ -d "$dir" ]; then
echo "Moving $dir -> LeetCode/$dir"
rm -rf "LeetCode/$dir" # ๊ธฐ์กด์ ์์ผ๋ฉด ์ญ์ ํ ๊ต์ฒด
mv "$dir" LeetCode/
fi
done
# ๋ฃจํธ์ ๋จ์ ์๋ LeetCode ๋ฌธ์ ํด๋๋ ์ ๋ถ ์ญ์ (Baekjoon, Programmers๋ ๊ฑด๋๋ฆฌ์ง ์์)
rm -rf [0-9][0-9][0-9][0-9]-*
- name: Commit changes
run: |
git config --global user.name "leegyuho-programer"
git config --global user.email "101032270+leegyuho-programer@users.noreply.github.com"
git add LeetCode/
git rm -rf --ignore-unmatch [0-9][0-9][0-9][0-9]-* # Git ์ธ๋ฑ์ค์์ ๋ฃจํธ LeetCode ๋ฌธ์ ํด๋ ์ ๊ฑฐ
git diff --cached --quiet || (git commit -m "chore: organize LeetCode problems into /LeetCode (Baekjoon & Programmers untouched)" && git push)