Skip to content

Commit 03d52f9

Browse files
committed
ci: add week filtering option for PR approval and merging
1 parent 671f1df commit 03d52f9

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

โ€Ž.github/workflows/management.yamlโ€Ž

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
options:
1212
- approve-prs
1313
- merge-prs
14+
week:
15+
description: 'Week number to filter (optional, e.g., "1")'
16+
required: false
17+
type: string
18+
default: ""
1419
exclude_prs:
1520
description: 'PR numbers to exclude (comma-separated, e.g., "1972,1973")'
1621
required: false
@@ -40,11 +45,20 @@ jobs:
4045
excludes="[$(echo "$exclude_input" | sed 's/,/, /g')]"
4146
fi
4247
48+
# Parse week input
49+
week_input="${{ inputs.week }}"
50+
if [ -z "$week_input" ]; then
51+
week_param=""
52+
else
53+
week_param=", \"week\": $week_input"
54+
fi
55+
56+
echo "์ฃผ์ฐจ ํ•„ํ„ฐ: ${week_input:-์ „์ฒด}"
4357
echo "์ œ์™ธํ•  PR: $excludes"
4458
4559
response=$(curl -s -X POST "https://github.dalestudy.com/approve-prs" \
4660
-H "Content-Type: application/json" \
47-
-d "{\"repo_name\": \"${{ github.event.repository.name }}\", \"excludes\": $excludes}")
61+
-d "{\"repo_name\": \"${{ github.event.repository.name }}\", \"excludes\": $excludes$week_param}")
4862
4963
echo "response=$response" >> $GITHUB_OUTPUT
5064
echo "$response" | jq '.'
@@ -55,6 +69,10 @@ jobs:
5569
5670
success=$(echo "$response" | jq -r '.success // false')
5771
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')
5876
processed=$(echo "$response" | jq -r '.processed // 0')
5977
approved=$(echo "$response" | jq -r '.approved // 0')
6078
skipped=$(echo "$response" | jq -r '.skipped // 0')
@@ -69,7 +87,15 @@ jobs:
6987
fi
7088
7189
echo "" >> $GITHUB_STEP_SUMMARY
90+
if [ "$week_filter" != "null" ]; then
91+
echo "- ๐Ÿ—“๏ธ ์ฃผ์ฐจ ํ•„ํ„ฐ: **Week $week_filter**" >> $GITHUB_STEP_SUMMARY
92+
fi
7293
echo "- ๐Ÿ“‹ ์ „์ฒด Open PR: **$total**๊ฐœ" >> $GITHUB_STEP_SUMMARY
94+
if [ "$week_filter" != "null" ]; then
95+
echo "- โœ… Week $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
7399
echo "- ๐Ÿ” ๊ฒ€์‚ฌํ•œ PR: **$processed**๊ฐœ" >> $GITHUB_STEP_SUMMARY
74100
echo "- โœ… ์Šน์ธํ•œ PR: **$approved**๊ฐœ" >> $GITHUB_STEP_SUMMARY
75101
echo "- โญ๏ธ ๊ฑด๋„ˆ๋›ด PR: **$skipped**๊ฐœ" >> $GITHUB_STEP_SUMMARY
@@ -105,13 +131,22 @@ jobs:
105131
excludes="[$(echo "$exclude_input" | sed 's/,/, /g')]"
106132
fi
107133
134+
# Parse week input
135+
week_input="${{ inputs.week }}"
136+
if [ -z "$week_input" ]; then
137+
week_param=""
138+
else
139+
week_param=", \"week\": $week_input"
140+
fi
141+
108142
merge_method="merge"
109143
echo "๋จธ์ง€ ๋ฐฉ์‹: $merge_method"
144+
echo "์ฃผ์ฐจ ํ•„ํ„ฐ: ${week_input:-์ „์ฒด}"
110145
echo "์ œ์™ธํ•  PR: $excludes"
111146
112147
response=$(curl -s -X POST "https://github.dalestudy.com/merge-prs" \
113148
-H "Content-Type: application/json" \
114-
-d "{\"repo_name\": \"${{ github.event.repository.name }}\", \"merge_method\": \"$merge_method\", \"excludes\": $excludes}")
149+
-d "{\"repo_name\": \"${{ github.event.repository.name }}\", \"merge_method\": \"$merge_method\", \"excludes\": $excludes$week_param}")
115150
116151
echo "response=$response" >> $GITHUB_OUTPUT
117152
echo "$response" | jq '.'
@@ -122,6 +157,10 @@ jobs:
122157
123158
success=$(echo "$response" | jq -r '.success // false')
124159
total=$(echo "$response" | jq -r '.total_open_prs // 0')
160+
week_filter=$(echo "$response" | jq -r '.week_filter // null')
161+
week_matched=$(echo "$response" | jq -r '.week_matched // 0')
162+
week_mismatched=$(echo "$response" | jq -r '.week_mismatched // 0')
163+
solving_excluded=$(echo "$response" | jq -r '.solving_excluded // 0')
125164
processed=$(echo "$response" | jq -r '.processed // 0')
126165
merged=$(echo "$response" | jq -r '.merged // 0')
127166
skipped=$(echo "$response" | jq -r '.skipped // 0')
@@ -138,7 +177,15 @@ jobs:
138177
139178
echo "" >> $GITHUB_STEP_SUMMARY
140179
echo "- ๐Ÿ”ง ๋จธ์ง€ ๋ฐฉ์‹: **$merge_method**" >> $GITHUB_STEP_SUMMARY
180+
if [ "$week_filter" != "null" ]; then
181+
echo "- ๐Ÿ—“๏ธ ์ฃผ์ฐจ ํ•„ํ„ฐ: **Week $week_filter**" >> $GITHUB_STEP_SUMMARY
182+
fi
141183
echo "- ๐Ÿ“‹ ์ „์ฒด Open PR: **$total**๊ฐœ" >> $GITHUB_STEP_SUMMARY
184+
if [ "$week_filter" != "null" ]; then
185+
echo "- โœ… Week $week_filter ๋งค์นญ: **$week_matched**๊ฐœ" >> $GITHUB_STEP_SUMMARY
186+
echo "- โŒ Week ๋ถˆ์ผ์น˜: **$week_mismatched**๊ฐœ" >> $GITHUB_STEP_SUMMARY
187+
echo "- ๐Ÿ”„ Solving ์ƒํƒœ ์ œ์™ธ: **$solving_excluded**๊ฐœ" >> $GITHUB_STEP_SUMMARY
188+
fi
142189
echo "- ๐Ÿ” ๊ฒ€์‚ฌํ•œ PR: **$processed**๊ฐœ" >> $GITHUB_STEP_SUMMARY
143190
echo "- โœ… ๋จธ์ง€ํ•œ PR: **$merged**๊ฐœ" >> $GITHUB_STEP_SUMMARY
144191
echo "- โญ๏ธ ๊ฑด๋„ˆ๋›ด PR: **$skipped**๊ฐœ" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
ย (0)