From 23a2bc78b61426f0e41b9c6269c8dd5c6a641f0a Mon Sep 17 00:00:00 2001 From: Nam Heo Date: Mon, 10 Aug 2026 16:16:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?test:=20PR=EB=A8=B8=EC=8B=A0=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=20=EA=B2=80=EC=A6=9D=EC=9A=A9=20=EC=8A=A4=EB=AA=A8?= =?UTF-8?q?=ED=81=AC=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homework/ML_FactoryAutomation/tests/test_pr_machine_smoke.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Homework/ML_FactoryAutomation/tests/test_pr_machine_smoke.py diff --git a/Homework/ML_FactoryAutomation/tests/test_pr_machine_smoke.py b/Homework/ML_FactoryAutomation/tests/test_pr_machine_smoke.py new file mode 100644 index 0000000..f513f97 --- /dev/null +++ b/Homework/ML_FactoryAutomation/tests/test_pr_machine_smoke.py @@ -0,0 +1,3 @@ +# PR머신 동작 검증용 스모크 테스트 (안전한 트리비얼 변경 — sensitive/opus 경로 아님) +def test_pr_machine_smoke(): + assert True From 1197022c091f68397c622ff183684a90a008ee4f Mon Sep 17 00:00:00 2001 From: Nam Heo Date: Mon, 10 Aug 2026 16:21:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20PR=EB=A8=B8=EC=8B=A0=20=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EB=B2=84=EA=B7=B8=203?= =?UTF-8?q?=EA=B1=B4=20=EC=88=98=EC=A0=95=20(id-token=20=EA=B6=8C=ED=95=9C?= =?UTF-8?q?,=20claude=5Fargs,=20pytest=20=EB=AF=B8=EC=84=A4=EC=B9=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-machine.yml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-machine.yml b/.github/workflows/pr-machine.yml index bbb3206..ba6b577 100644 --- a/.github/workflows/pr-machine.yml +++ b/.github/workflows/pr-machine.yml @@ -21,6 +21,7 @@ permissions: contents: write pull-requests: write issues: write + id-token: write jobs: determine-tier: @@ -102,21 +103,38 @@ jobs: id: tests run: | set +e - CHANGED_DIRS=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD | xargs -n1 dirname | sort -u) + pip install -q pytest + CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD) RESULT="pass" - for d in $CHANGED_DIRS; do - if [ -f "$d/requirements.txt" ] || ls "$d"/test_*.py >/dev/null 2>&1; then - (cd "$d" && pip install -q -r requirements.txt 2>/dev/null; pytest -q) || RESULT="fail" + RAN_ANY="false" + for f in $CHANGED_FILES; do + d="$f" + while [ "$d" != "." ] && [ -n "$d" ]; do + if [ -f "$d/requirements.txt" ]; then + pip install -q -r "$d/requirements.txt" 2>/dev/null + fi + d=$(dirname "$d") + done + done + TEST_DIRS=$(echo "$CHANGED_FILES" | xargs -n1 dirname | sort -u) + for d in $TEST_DIRS; do + if ls "$d"/test_*.py >/dev/null 2>&1; then + RAN_ANY="true" + (cd "$d" && pytest -q) || RESULT="fail" fi done + if [ "$RAN_ANY" = "false" ]; then + echo "(변경된 테스트 파일 없음 — pytest 스킵, pass 처리)" + fi echo "result=$RESULT" >> "$GITHUB_OUTPUT" - name: Claude 리뷰 + 라벨링 + (조건 충족 시) 자동 머지 uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - model: ${{ needs.determine-tier.outputs.model_id }} - allowed_tools: "Bash(gh *),Bash(git *)" + claude_args: | + --model ${{ needs.determine-tier.outputs.model_id }} + --allowedTools "Bash(gh *),Bash(git *)" prompt: | 너는 이 개인 레포(vapsnamheo-dev/AISOURCE)의 PR머신이다. PR #${{ github.event.pull_request.number }}를 정적/동적 관점에서 리뷰하고,