Skip to content

Commit e4e3140

Browse files
authored
Merge branch 'DaleStudy:main' into main
2 parents 85c431d + 97ce36d commit e4e3140

File tree

384 files changed

+11998
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+11998
-154
lines changed

.github/workflows/integration.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: Integration 🔄
22

33
on:
44
pull_request:
5+
merge_group:
56

67
jobs:
78
linelint:
89
runs-on: ubuntu-latest
10+
if: github.event_name == 'pull_request'
911
steps:
1012
- uses: actions/checkout@v4
1113
with:
@@ -17,11 +19,11 @@ jobs:
1719
run: |
1820
echo "🔍 PR 번호: ${{ github.event.pull_request.number }}"
1921
pr_number="${{ github.event.pull_request.number }}"
20-
22+
2123
echo "📋 PR 라벨 조회 중..."
2224
labels_json=$(gh pr view $pr_number --json labels -q '.labels[].name')
2325
echo "확인된 라벨: $labels_json"
24-
26+
2527
if [ -n "$labels_json" ]; then
2628
has_maintenance=$(echo $labels_json | grep -q 'maintenance' && echo 'true' || echo 'false')
2729
echo "maintenance 라벨 포함 여부: $has_maintenance"

.github/workflows/management.yaml

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
name: Management 🔧
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
action:
7+
description: "Action to perform"
8+
required: true
9+
type: choice
10+
default: "approve-prs"
11+
options:
12+
- approve-prs
13+
- merge-prs
14+
week:
15+
description: 'Week number to filter (optional, e.g., "1")'
16+
required: false
17+
type: string
18+
default: ""
19+
exclude_prs:
20+
description: 'PR numbers to exclude (comma-separated, e.g., "1972,1973")'
21+
required: false
22+
type: string
23+
default: ""
24+
25+
jobs:
26+
approve-prs:
27+
name: Approve Open PRs 👍
28+
runs-on: ubuntu-latest
29+
if: ${{ inputs.action == 'approve-prs' }}
30+
permissions:
31+
contents: read
32+
33+
steps:
34+
- name: Approve PRs via GitHub App
35+
id: approve
36+
run: |
37+
echo "👍 GitHub App을 통해 모든 Open PR 승인 중..."
38+
39+
# Parse exclude_prs input into JSON array
40+
exclude_input="${{ inputs.exclude_prs }}"
41+
if [ -z "$exclude_input" ]; then
42+
excludes="[]"
43+
else
44+
# Convert "1972,1973" to [1972,1973]
45+
excludes="[$(echo "$exclude_input" | sed 's/,/, /g')]"
46+
fi
47+
48+
# Build request payload
49+
week_input="${{ inputs.week }}"
50+
if [ -z "$week_input" ]; then
51+
payload="{\"repo_name\": \"${{ github.event.repository.name }}\", \"excludes\": $excludes}"
52+
else
53+
payload="{\"repo_name\": \"${{ github.event.repository.name }}\", \"week\": \"Week $week_input\", \"excludes\": $excludes}"
54+
fi
55+
56+
echo "주차 필터: ${week_input:-전체}"
57+
echo "제외할 PR: $excludes"
58+
59+
response=$(curl -s -X POST "https://github.dalestudy.com/approve-prs" \
60+
-H "Content-Type: application/json" \
61+
-d "$payload")
62+
63+
echo "response=$response" >> $GITHUB_OUTPUT
64+
echo "$response" | jq '.'
65+
66+
- name: Summary
67+
run: |
68+
response='${{ steps.approve.outputs.response }}'
69+
70+
success=$(echo "$response" | jq -r '.success // false')
71+
total=$(echo "$response" | jq -r '.total_open_prs // 0')
72+
week_filter=$(echo "$response" | jq -r '.week_filter // null')
73+
week_matched=$(echo "$response" | jq -r '.week_matched // 0')
74+
week_mismatched=$(echo "$response" | jq -r '.week_mismatched // 0')
75+
solving_excluded=$(echo "$response" | jq -r '.solving_excluded // 0')
76+
processed=$(echo "$response" | jq -r '.processed // 0')
77+
approved=$(echo "$response" | jq -r '.approved // 0')
78+
skipped=$(echo "$response" | jq -r '.skipped // 0')
79+
80+
echo "## 👍 PR 승인 완료" >> $GITHUB_STEP_SUMMARY
81+
echo "" >> $GITHUB_STEP_SUMMARY
82+
83+
if [ "$success" = "true" ]; then
84+
echo "✅ **성공적으로 완료되었습니다**" >> $GITHUB_STEP_SUMMARY
85+
else
86+
echo "❌ **오류가 발생했습니다**" >> $GITHUB_STEP_SUMMARY
87+
fi
88+
89+
echo "" >> $GITHUB_STEP_SUMMARY
90+
if [ "$week_filter" != "null" ]; then
91+
echo "- 🗓️ 주차 필터: **$week_filter**" >> $GITHUB_STEP_SUMMARY
92+
fi
93+
echo "- 📋 전체 Open PR: **$total**개" >> $GITHUB_STEP_SUMMARY
94+
if [ "$week_filter" != "null" ]; then
95+
echo "- ✅ $week_filter 매칭: **$week_matched**개" >> $GITHUB_STEP_SUMMARY
96+
echo "- ❌ Week 불일치: **$week_mismatched**개" >> $GITHUB_STEP_SUMMARY
97+
echo "- 🔄 Solving 상태 제외: **$solving_excluded**개" >> $GITHUB_STEP_SUMMARY
98+
fi
99+
echo "- 🔍 검사한 PR: **$processed**개" >> $GITHUB_STEP_SUMMARY
100+
echo "- ✅ 승인한 PR: **$approved**개" >> $GITHUB_STEP_SUMMARY
101+
echo "- ⏭️ 건너뛴 PR: **$skipped**개" >> $GITHUB_STEP_SUMMARY
102+
103+
# Show detailed results if available
104+
result_count=$(echo "$response" | jq -r '.results | length')
105+
if [ "$result_count" -gt 0 ]; then
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo "### 📝 상세 결과" >> $GITHUB_STEP_SUMMARY
108+
echo "" >> $GITHUB_STEP_SUMMARY
109+
110+
echo "$response" | jq -c '.results[]' | while read -r item; do
111+
pr=$(echo "$item" | jq -r '.pr')
112+
title=$(echo "$item" | jq -r '.title')
113+
skipped=$(echo "$item" | jq -r '.skipped // false')
114+
approved=$(echo "$item" | jq -r '.approved // false')
115+
reason=$(echo "$item" | jq -r '.reason // ""')
116+
error=$(echo "$item" | jq -r '.error // ""')
117+
118+
if [ "$skipped" = "true" ]; then
119+
echo "- PR #$pr [$title]: ⏭️ skipped ($reason)" >> $GITHUB_STEP_SUMMARY
120+
elif [ "$approved" = "true" ]; then
121+
echo "- PR #$pr [$title]: ✅ approved" >> $GITHUB_STEP_SUMMARY
122+
else
123+
echo "- PR #$pr [$title]: ❌ failed (${error:-unknown})" >> $GITHUB_STEP_SUMMARY
124+
fi
125+
done
126+
fi
127+
128+
merge-prs:
129+
name: Merge Open PRs 🚀
130+
runs-on: ubuntu-latest
131+
if: ${{ inputs.action == 'merge-prs' }}
132+
permissions:
133+
contents: read
134+
135+
steps:
136+
- name: Merge PRs via GitHub App
137+
id: merge
138+
run: |
139+
echo "🚀 GitHub App을 통해 모든 승인된 PR 머지 중..."
140+
141+
# Parse exclude_prs input into JSON array
142+
exclude_input="${{ inputs.exclude_prs }}"
143+
if [ -z "$exclude_input" ]; then
144+
excludes="[]"
145+
else
146+
# Convert "1972,1973" to [1972,1973]
147+
excludes="[$(echo "$exclude_input" | sed 's/,/, /g')]"
148+
fi
149+
150+
# Build request payload
151+
week_input="${{ inputs.week }}"
152+
merge_method="merge"
153+
154+
if [ -z "$week_input" ]; then
155+
payload="{\"repo_name\": \"${{ github.event.repository.name }}\", \"merge_method\": \"$merge_method\", \"excludes\": $excludes}"
156+
else
157+
payload="{\"repo_name\": \"${{ github.event.repository.name }}\", \"merge_method\": \"$merge_method\", \"week\": \"Week $week_input\", \"excludes\": $excludes}"
158+
fi
159+
160+
echo "머지 방식: $merge_method"
161+
echo "주차 필터: ${week_input:-전체}"
162+
echo "제외할 PR: $excludes"
163+
164+
response=$(curl -s -X POST "https://github.dalestudy.com/merge-prs" \
165+
-H "Content-Type: application/json" \
166+
-d "$payload")
167+
168+
echo "response=$response" >> $GITHUB_OUTPUT
169+
echo "$response" | jq '.'
170+
171+
- name: Summary
172+
run: |
173+
response='${{ steps.merge.outputs.response }}'
174+
175+
success=$(echo "$response" | jq -r '.success // false')
176+
total=$(echo "$response" | jq -r '.total_open_prs // 0')
177+
week_filter=$(echo "$response" | jq -r '.week_filter // null')
178+
week_matched=$(echo "$response" | jq -r '.week_matched // 0')
179+
week_mismatched=$(echo "$response" | jq -r '.week_mismatched // 0')
180+
solving_excluded=$(echo "$response" | jq -r '.solving_excluded // 0')
181+
processed=$(echo "$response" | jq -r '.processed // 0')
182+
merged=$(echo "$response" | jq -r '.merged // 0')
183+
skipped=$(echo "$response" | jq -r '.skipped // 0')
184+
merge_method=$(echo "$response" | jq -r '.merge_method // "unknown"')
185+
186+
echo "## 🚀 PR 머지 완료" >> $GITHUB_STEP_SUMMARY
187+
echo "" >> $GITHUB_STEP_SUMMARY
188+
189+
if [ "$success" = "true" ]; then
190+
echo "✅ **성공적으로 완료되었습니다**" >> $GITHUB_STEP_SUMMARY
191+
else
192+
echo "❌ **오류가 발생했습니다**" >> $GITHUB_STEP_SUMMARY
193+
fi
194+
195+
echo "" >> $GITHUB_STEP_SUMMARY
196+
echo "- 🔧 머지 방식: **$merge_method**" >> $GITHUB_STEP_SUMMARY
197+
if [ "$week_filter" != "null" ]; then
198+
echo "- 🗓️ 주차 필터: **$week_filter**" >> $GITHUB_STEP_SUMMARY
199+
fi
200+
echo "- 📋 전체 Open PR: **$total**개" >> $GITHUB_STEP_SUMMARY
201+
if [ "$week_filter" != "null" ]; then
202+
echo "- ✅ $week_filter 매칭: **$week_matched**개" >> $GITHUB_STEP_SUMMARY
203+
echo "- ❌ Week 불일치: **$week_mismatched**개" >> $GITHUB_STEP_SUMMARY
204+
echo "- 🔄 Solving 상태 제외: **$solving_excluded**개" >> $GITHUB_STEP_SUMMARY
205+
fi
206+
echo "- 🔍 검사한 PR: **$processed**개" >> $GITHUB_STEP_SUMMARY
207+
echo "- ✅ 머지한 PR: **$merged**개" >> $GITHUB_STEP_SUMMARY
208+
echo "- ⏭️ 건너뛴 PR: **$skipped**개" >> $GITHUB_STEP_SUMMARY
209+
210+
# Show detailed results if available
211+
result_count=$(echo "$response" | jq -r '.results | length')
212+
if [ "$result_count" -gt 0 ]; then
213+
echo "" >> $GITHUB_STEP_SUMMARY
214+
echo "### 📝 상세 결과" >> $GITHUB_STEP_SUMMARY
215+
echo "" >> $GITHUB_STEP_SUMMARY
216+
217+
echo "$response" | jq -c '.results[]' | while read -r item; do
218+
pr=$(echo "$item" | jq -r '.pr')
219+
title=$(echo "$item" | jq -r '.title')
220+
skipped=$(echo "$item" | jq -r '.skipped // false')
221+
merged=$(echo "$item" | jq -r '.merged // false')
222+
reason=$(echo "$item" | jq -r '.reason // ""')
223+
error=$(echo "$item" | jq -r '.error // ""')
224+
225+
if [ "$skipped" = "true" ]; then
226+
echo "- PR #$pr [$title]: ⏭️ skipped ($reason)" >> $GITHUB_STEP_SUMMARY
227+
elif [ "$merged" = "true" ]; then
228+
echo "- PR #$pr [$title]: ✅ merged" >> $GITHUB_STEP_SUMMARY
229+
else
230+
echo "- PR #$pr [$title]: ❌ failed (${error:-unknown})" >> $GITHUB_STEP_SUMMARY
231+
fi
232+
done
233+
fi

.github/workflows/weekcheck.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Week Check 🗓️
2+
3+
on:
4+
schedule:
5+
# 매일 오전 10시, 오후 6시 (KST 기준, UTC로는 1시, 9시)
6+
- cron: "0 1,9 * * *"
7+
workflow_dispatch:
8+
9+
jobs:
10+
check-weeks:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
15+
steps:
16+
- name: Check all PRs via GitHub App
17+
id: check
18+
run: |
19+
echo "🔍 GitHub App을 통해 모든 Open PR 검사 중..."
20+
21+
response=$(curl -s -X POST "https://github.dalestudy.com/check-weeks" \
22+
-H "Content-Type: application/json" \
23+
-d "{\"repo_owner\": \"${{ github.repository_owner }}\", \"repo_name\": \"${{ github.event.repository.name }}\"}")
24+
25+
echo "response=$response" >> $GITHUB_OUTPUT
26+
echo "$response" | jq '.'
27+
28+
- name: Summary
29+
run: |
30+
response='${{ steps.check.outputs.response }}'
31+
32+
total=$(echo "$response" | jq -r '.total_prs // 0')
33+
checked=$(echo "$response" | jq -r '.checked // 0')
34+
commented=$(echo "$response" | jq -r '.commented // 0')
35+
deleted=$(echo "$response" | jq -r '.deleted // 0')
36+
37+
echo "## 🎯 Week 설정 체크 완료" >> $GITHUB_STEP_SUMMARY
38+
echo "" >> $GITHUB_STEP_SUMMARY
39+
echo "- 📋 전체 Open PR: **$total**개" >> $GITHUB_STEP_SUMMARY
40+
echo "- ✅ 검사한 PR: **$checked**개" >> $GITHUB_STEP_SUMMARY
41+
echo "- 💬 댓글 작성한 PR: **$commented**개" >> $GITHUB_STEP_SUMMARY
42+
echo "- 🗑️ 댓글 삭제한 PR: **$deleted**개" >> $GITHUB_STEP_SUMMARY
43+
echo "" >> $GITHUB_STEP_SUMMARY
44+
echo "다음 체크: $(date -u -d '+1 hour' +'%Y-%m-%d %H:00 UTC')" >> $GITHUB_STEP_SUMMARY

3sum/WHYjun.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class Solution:
2+
def threeSum(self, nums: List[int]) -> List[List[int]]:
3+
answer = []
4+
sortedNums = sorted(nums)
5+
6+
for i in range(len(sortedNums)):
7+
# skip if same to avoid dup
8+
if i > 0 and sortedNums[i] == sortedNums[i-1]:
9+
continue
10+
11+
# use two pointers
12+
j = i + 1
13+
k = len(sortedNums) - 1
14+
15+
while j < k:
16+
total = sortedNums[i] + sortedNums[j] + sortedNums[k]
17+
18+
if total == 0:
19+
answer.append([sortedNums[i], sortedNums[j], sortedNums[k]])
20+
j += 1
21+
# skip if same to avoid dup
22+
while sortedNums[j] == sortedNums[j-1] and j < k:
23+
j += 1
24+
elif total < 0:
25+
j += 1
26+
else:
27+
k -= 1
28+
29+
return answer

alien-dictionary/hu6r1s.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from typing import (
2+
List,
3+
)
4+
5+
import heapq
6+
heap = [c for c in indegree if indegree[c] == 0]
7+
heapq.heapify(heap)
8+
res = []
9+
10+
11+
class Solution:
12+
"""
13+
@param words: a list of words
14+
@return: a string which is correct order
15+
"""
16+
def alien_order(self, words: List[str]) -> str:
17+
# Write your code here
18+
adj = {c: set() for word in words for c in word}
19+
indegree = {c: 0 for c in adj}
20+
21+
for i in range(len(words) - 1):
22+
w1, w2 = words[i], words[i+1]
23+
minlen = min(len(w1), len(w2))
24+
if len(w1) > len(w2) and w1[:minlen] == w2[:minlen]:
25+
return ""
26+
for j in range(minlen):
27+
if w1[j] != w2[j]:
28+
if w2[j] not in adj[w1[j]]:
29+
adj[w1[j]].add(w2[j])
30+
indegree[w2[j]] += 1
31+
break
32+
33+
while heap:
34+
c = heapq.heappop(heap)
35+
res.append(c)
36+
for nei in adj[c]:
37+
indegree[nei] -= 1
38+
if indegree[nei] == 0:
39+
heapq.heappush(heap, nei)
40+
41+
if len(res) != len(adj):
42+
return ""
43+
44+
return "".join(res)

0 commit comments

Comments
 (0)