-
Notifications
You must be signed in to change notification settings - Fork 2
chore: 이슈 닫기 워크플로우 추가 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a GitHub Actions workflow that runs when a pull request is merged into dev or main; it closes linked issues found in the PR body using the GitHub CLI and then attempts to delete the PR source branch, handling failures gracefully. Changes
Sequence DiagramsequenceDiagram
actor GitHub as GitHub Event
participant Workflow as PR Merge Cleanup
participant Repo as Repository
participant CLI as gh CLI
participant Issues as Issue Tracker
GitHub->>Workflow: PR closed & merged to dev/main
Workflow->>Repo: actions/checkout
rect rgb(230,240,255)
Note over Workflow: Parse PR body for issue references\n(keywords + `#number`)
Workflow->>CLI: gh issue close `#NNN` --reason completed
CLI->>Issues: Close issue
Workflow->>Workflow: Tally successes/failures
end
rect rgb(235,255,230)
Note over Workflow: Delete source branch
Workflow->>CLI: gh api repos/{owner}/{repo}/git/refs/heads/{branch} -X DELETE
alt deletion succeeds
CLI->>Repo: Remove branch ref
else deletion fails (not found/permission)
Workflow->>Workflow: Log and continue
end
end
Workflow-->>GitHub: Complete (summary)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a GitHub Actions workflow to automatically close linked issues when pull requests are merged to the dev branch, not just the default main branch. This helps maintain a cleaner issue tracking process.
- Added workflow that triggers on PR close events
- Configured to detect issue-closing keywords (close, fix, resolve) in PR descriptions
- Uses GitHub CLI to automatically close referenced issues when PRs merge to dev or main branches
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| shell: bash | ||
| run: | | ||
| echo "🔍 PR 내용에서 이슈 닫는 키워드를 찾는 중..." | ||
| printf '%s' "$PR_BODY" | tr -d '\r' | grep -Eoi '(close[sd]?|fix(e[sd])?|resolve[sd]?) #[0-9]+' | while read -r match; do |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern used here may not correctly match keywords with plural forms. The pattern close[sd]? will match "close", "closes", or "closed", but fix(e[sd])? will only match "fix", "fixes", "fixed" - it won't match "fixe" which is not a valid word anyway. However, the pattern should be fix(e[sd]?)? to properly match "fix", "fixed", "fixes". Similarly, resolve[sd]? will match "resolve", "resolves", "resolved" correctly.
Consider updating the regex to: (close[sd]?|fix(e[sd]?)?|resolve[sd]?) #[0-9]+
This ensures "fixed" and "fixes" are both properly matched.
| printf '%s' "$PR_BODY" | tr -d '\r' | grep -Eoi '(close[sd]?|fix(e[sd])?|resolve[sd]?) #[0-9]+' | while read -r match; do | |
| printf '%s' "$PR_BODY" | tr -d '\r' | grep -Eoi '(close[sd]?|fix(e[sd]?)?|resolve[sd]?) #[0-9]+' | while read -r match; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/auto-close-issues.yml (1)
22-23: Consider removing the unnecessary Checkout step.The workflow only uses the GitHub CLI to interact with the GitHub API and doesn't reference any local repository files. The
actions/checkout@v4step is not needed here and can be removed to streamline the workflow.Apply this diff to remove the unnecessary step:
steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Close linked issues via gh CLI
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/auto-close-issues.yml(1 hunks)
🔇 Additional comments (2)
.github/workflows/auto-close-issues.yml (2)
32-32: Verify regex pattern matches intended GitHub closing keywords.The regex pattern
fix(e[sd])?may produce unintended matches. Specifically:
- Intended matches: "fix", "fixes", "fixed"
- Actual matches: "fix", "fixe", "fixes", "fixed"
The substring "fixe" alone is not a standard GitHub closing keyword. Consider whether this is intentional or if the pattern should be
fix(es|ed)?instead.If this was unintentional, apply this diff:
- printf '%s' "$PR_BODY" | tr -d '\r' | grep -Eoi '(close[sd]?|fix(e[sd])?|resolve[sd]?) #[0-9]+' | while read -r match; do + printf '%s' "$PR_BODY" | tr -d '\r' | grep -Eoi '(close[sd]?|fix(es|ed)?|resolve[sd]?) #[0-9]+' | while read -r match; do
10-36: Workflow logic is sound.The overall approach is correct: conditional execution on merged PRs targeting dev/main, appropriate permissions, proper GitHub CLI usage, and graceful handling of edge cases (empty body, multiple issues). The workflow will successfully close linked issues as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/pr-merge-cleanup.yml (1)
17-20: Minor: Unused permission scope.Line 19 requests
pull-requests: write, but the workflow only closes issues (line 48) and deletes branches (line 67). Theissues: writeandcontents: writepermissions should suffice. Removingpull-requests: writefollows the principle of least privilege.permissions: issues: write - pull-requests: write contents: write
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pr-merge-cleanup.yml(1 hunks)
🔇 Additional comments (2)
.github/workflows/pr-merge-cleanup.yml (2)
26-58: Robust issue-closing implementation.The issue extraction and closing logic is solid. The regex pattern correctly captures all three keyword families, deduplication prevents retries, early exit saves cycles when no issues are found, and error handling with counters enables clear reporting. The validation of non-empty issue numbers (line 46) guards against malformed grep output.
60-67: Branch deletion is appropriately fault-tolerant.The branch deletion gracefully handles failures (already deleted, missing permissions, etc.) and won't block the workflow. This aligns well with the PR objective of keeping the branch list clean while remaining resilient.
psm1st
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨어요~
💡 To Reviewers
🔥 작업 내용 (가능한 구체적으로 작성해 주세요)
🤔 추후 작업 예정
📸 작업 결과 (스크린샷)
🔗 관련 이슈
Summary by CodeRabbit