Skip to content

Commit 923f0af

Browse files
committed
fix: handle gh command errors gracefully
- Suppress stderr output for gh commands - Continue workflow even if comment posting fails - Add clearer error messages
1 parent 3aecc3f commit 923f0af

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

β€Ž.github/workflows/check-project-scheduled.yamlβ€Ž

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,24 @@ jobs:
6565
6666
# Week 섀정이 μ—†μœΌλ©΄ λŒ“κΈ€ μž‘μ„±
6767
if [ "$week" = "null" ] || [ -z "$week" ]; then
68-
echo " ⚠️ Week μ„€μ • λˆ„λ½ - λŒ“κΈ€ μž‘μ„±"
68+
echo " ⚠️ Week μ„€μ • λˆ„λ½ - λŒ“κΈ€ μž‘μ„± μ‹œλ„"
6969
70-
# 이미 봇이 λŒ“κΈ€μ„ λ‹¬μ•˜λŠ”μ§€ 확인
70+
# 이미 봇이 λŒ“κΈ€μ„ λ‹¬μ•˜λŠ”μ§€ 확인 (μ—λŸ¬ λ°œμƒ μ‹œ λ¬΄μ‹œ)
7171
existing_comment=$(gh pr view $pr_number \
7272
--repo ${{ github.repository }} \
7373
--json comments \
7474
--jq '.comments[] | select(.author.login == "github-actions[bot]") | select(.body | contains("Week 섀정이 λˆ„λ½")) | .id' \
75-
| head -n 1)
75+
2>/dev/null | head -n 1) || true
7676
7777
if [ -z "$existing_comment" ]; then
7878
# μƒˆ λŒ“κΈ€ μž‘μ„±
79-
gh pr comment $pr_number \
79+
if gh pr comment $pr_number \
8080
--repo ${{ github.repository }} \
81-
--body $'## ⚠️ Week 섀정이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€\n\nν”„λ‘œμ νŠΈμ—μ„œ Weekλ₯Ό μ„€μ •ν•΄μ£Όμ„Έμš”!\n\n### μ„€μ • 방법\n1. PR 우츑의 `Projects` μ„Ήμ…˜μ—μ„œ `λ¦¬νŠΈμ½”λ“œ μŠ€ν„°λ””` μ˜† λ“œλ‘­λ‹€μš΄(β–Ό) 클릭\n2. ν˜„μž¬ μ£Όμ°¨λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš” (예: `Week 14(current)` λ˜λŠ” `Week 14`)\n\nπŸ“š [μžμ„Έν•œ κ°€μ΄λ“œ 보기](https://github.com/DaleStudy/leetcode-study/wiki/%EB%8B%B5%EC%95%88-%EC%A0%9C%EC%B6%9C-%EA%B0%80%EC%9D%B4%EB%93%9C#pr-%EC%9E%91%EC%84%B1%EB%B2%95)\n\n---\nπŸ€– 이 λŒ“κΈ€μ€ GitHub App을 톡해 μžλ™μœΌλ‘œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€.'
82-
echo " βœ… λŒ“κΈ€ μž‘μ„± μ™„λ£Œ"
81+
--body $'## ⚠️ Week 섀정이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€\n\nν”„λ‘œμ νŠΈμ—μ„œ Weekλ₯Ό μ„€μ •ν•΄μ£Όμ„Έμš”!\n\n### μ„€μ • 방법\n1. PR 우츑의 `Projects` μ„Ήμ…˜μ—μ„œ `λ¦¬νŠΈμ½”λ“œ μŠ€ν„°λ””` μ˜† λ“œλ‘­λ‹€μš΄(β–Ό) 클릭\n2. ν˜„μž¬ μ£Όμ°¨λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš” (예: `Week 14(current)` λ˜λŠ” `Week 14`)\n\nπŸ“š [μžμ„Έν•œ κ°€μ΄λ“œ 보기](https://github.com/DaleStudy/leetcode-study/wiki/%EB%8B%B5%EC%95%88-%EC%A0%9C%EC%B6%9C-%EA%B0%80%EC%9D%B4%EB%93%9C#pr-%EC%9E%91%EC%84%B1%EB%B2%95)\n\n---\nπŸ€– 이 λŒ“κΈ€μ€ GitHub App을 톡해 μžλ™μœΌλ‘œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€.' 2>/dev/null; then
82+
echo " βœ… λŒ“κΈ€ μž‘μ„± μ™„λ£Œ"
83+
else
84+
echo " ❌ λŒ“κΈ€ μž‘μ„± μ‹€νŒ¨ (κΆŒν•œ 문제 κ°€λŠ₯μ„±)"
85+
fi
8386
else
8487
echo " ℹ️ 이미 μ•Œλ¦Ό λŒ“κΈ€μ΄ 있음 - μŠ€ν‚΅"
8588
fi

0 commit comments

Comments
Β (0)