Skip to content

Commit 235281a

Browse files
SamTheKoreanDaleSeo
authored andcommitted
ci: check weeks
2 parents 8103f51 + ade1ec0 commit 235281a

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.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-all-prs:
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
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Runtime: 8ms
2+
// Memory: 63.23MB
3+
4+
/**
5+
* Definition for a binary tree node.
6+
* class TreeNode {
7+
* val: number
8+
* left: TreeNode | null
9+
* right: TreeNode | null
10+
* constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {
11+
* this.val = (val===undefined ? 0 : val)
12+
* this.left = (left===undefined ? null : left)
13+
* this.right = (right===undefined ? null : right)
14+
* }
15+
* }
16+
*/
17+
18+
const isSameTree = (p, q): boolean => {
19+
if (!(p && q)) return p === q
20+
if (p.val !== q.val) return false
21+
return isSameTree(p.left, q.left) && isSameTree(p.right, q.right)
22+
}
23+
24+
function isSubtree(root: TreeNode | null, subRoot: TreeNode | null): boolean {
25+
if (!subRoot) return true
26+
if (!root) return false
27+
if (isSameTree(root, subRoot)) return true
28+
return isSubtree(root.left, subRoot) || isSubtree(root.right, subRoot)
29+
};

0 commit comments

Comments
 (0)