Skip to main content

Restricting code coverage on pull requests

Protect your test coverage by automatically blocking pull requests that fall below the coverage levels your team requires.

누가 이 기능을 사용할 수 있나요?

관리자 역할이 있는 리포지토리 소유자, 조직 소유자 및 사용자

이 기사에서

참고

This feature is in 공개 미리 보기 and subject to change.

Prerequisites

Creating a coverage threshold rule

  1. GitHub에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 Settings를 클릭합니다. "설정" 탭이 표시되지 않으면 드롭다운 메뉴를 선택한 다음 설정을 클릭합니다.

    탭을 보여 주는 리포지토리 헤더의 스크린샷. "설정" 탭이 진한 주황색 윤곽선으로 강조 표시됩니다.

  3. 왼쪽 사이드바의 "코드 및 자동화"에서 규칙을 클릭한 다음 규칙 세트를 클릭합니다.

    리포지토리에 대한 "설정" 페이지의 사이드바 스크린샷. "규칙" 하위 메뉴가 확장되고 "규칙 세트" 옵션이 주황색 윤곽선으로 표시되어 있습니다.

  4. Create a new branch ruleset or click an existing one to edit it.

  5. Under "Branch rules", select Restrict code coverage.

  6. Expand Additional settings to configure thresholds. A value of 0 means that the threshold is disabled.

    • Minimum coverage percentage: enter a value to block pull requests where aggregated coverage falls below this percentage.
    • Maximum coverage drop: enter a value to block pull requests where coverage drops by more than this many percentage points relative to the default branch.
  7. Click Create or Save changes.