Skip to content

feat(ci): auto-close pull requests with no net changes#312

Merged
seonghobae merged 1 commit into
mainfrom
feat/close-empty-pr
Jul 5, 2026
Merged

feat(ci): auto-close pull requests with no net changes#312
seonghobae merged 1 commit into
mainfrom
feat/close-empty-pr

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

목적

봇이 커밋은 있으나 base 대비 실제 변경(diff)이 0건인 PR(GitHub "No files changed / +0 -0")을 자동으로 닫습니다. (사용자 요청: "커밋을 했는데 변경 사항이 0이라면 자동으로 Close")

동작

  • close-empty-pr.ymlpull_request_target(opened/synchronize/reopened/ready_for_review)
  • changed_files == 0이면 코멘트 남기고 close. draft는 건드리지 않음.
  • diff 계산이 비동기라 changed_files가 null이면 잠깐 폴링 후 판정.
  • pull_request_target이지만 PR 코드를 checkout하지 않고 PR 메타데이터만 읽어 close하므로 인젝션 위험 없음. 리포별 write 토큰 사용.

후속 (머지 후)

조직 룰셋 workflows 필수 목록에 close-empty-pr.yml 추가(전 리포에서 실행). #310 security-scan 스왑과 함께 일괄 반영.

참고

지금 열려 있던 빈 PR 2건(.github#308, newsdom-api#264)은 이미 수동 스윕으로 닫았습니다.

🤖 Generated with Claude Code

Bot authors sometimes open PRs that have commits but a 0-file diff vs. base
(GitHub shows "No files changed / +0 -0"). Add a central pull_request_target
workflow that closes such empty PRs (leaving drafts alone) so humans do not
have to. Uses a write token without checking out PR code, so no code-execution
risk. Add close-empty-pr.yml to the org required-workflows list to run per repo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RTAMs4bpSZS77Xe3RQjv9P
@seonghobae seonghobae enabled auto-merge (squash) July 5, 2026 07:18
@seonghobae seonghobae merged commit 5e70057 into main Jul 5, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant