Create README - LeetHub #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |