[review] 자동 리뷰 시 PR 본문에 리액션 추가 - #20
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
자동 리뷰가 시작되어도 GitHub 화면에는 아무 표시가 남지 않아, 봇이 이벤트를 받았는지 확인할 방법이 없었습니다. 큐가 밀리면 리뷰가 끝나기까지 수십 분이 걸리는데 그동안 무반응이라, 무시된 것으로 보고 같은 요청을 되풀이하는 일이 있었습니다.
변경 사항
자동 리뷰 시 PR 본문에 리액션 추가
ReactionTarget에issue를 추가하고createForIssue분기를 두었습니다. GitHub은 PR을 이슈로도 다루므로 PR 번호를 그대로 넘깁니다.handler.ts의execute에서 코멘트 트리거가 아닌 경우, 즉 자동 리뷰일 때 PR 본문에eyes리액션을 답니다.addReaction의 첫 인자 이름을commentId에서id로 바꾸었습니다. 대상이 코멘트만은 아니게 되었기 때문입니다.리액션 등록 실패를 경고 로그로 노출
addReaction의 실패 로그를log.debug에서log.warn으로 올리고, 대상 종류와 id를 함께 남기도록 하였습니다.logger.ts는REVIEWBOT_DEBUG가 설정되지 않으면debug를 출력하지 않아, 리액션 실패 원인이 그대로 사라지고 있었습니다.남은 문제
인라인 리뷰 쓰레드에서 봇을 멘션했을 때 리액션이 달리지 않는 문제는 이번 변경에 포함되지 않았습니다.
/review로 부를 때는 정상 동작하므로 App 권한 문제는 아니며,createForPullRequestReviewComment경로만 실패하는 것으로 좁혀졌으나 실제 에러 메시지를 확보하지 못해 원인을 확정하지 못하였습니다. 이번에 올린warn로그로 다음 발생 시 확인할 예정입니다.또한 리액션을 다는 위치가 큐에서 차례가 온 뒤라, 큐가 밀리면 리액션도 함께 늦어집니다. 웹훅 수신 직후로 앞당기는 작업은
accept를 건드려야 하므로 이번 PR에 넣지 않았습니다.검증
npm run typecheck와npm run build를 통과하였습니다. 이 리포지토리에는 자동화된 테스트가 없으므로, 머지 후 테스트 리포지토리에서 실제 PR을 열어 자동 리뷰 리액션이 달리는지 확인이 필요합니다.