Skip to main content

경고: "이 워크플로에서 1개의 문제가 감지되었습니다. git 검사 HEAD^2가 더 이상 필요하지 않습니다."

이 경고가 표시되는 경우 현재 모범 사례를 따르도록 워크플로를 업데이트해야 합니다.

이 경고 정보

Warning: 1 issue was detected with this workflow: git checkout HEAD^2 is no longer
necessary. Please remove this step as Code Scanning recommends analyzing the merge
commit for best results.

이전 CodeQL 워크플로를 사용 중인 경우 “CodeQL 초기화” 작업에서 이 경고가 표시될 수 있습니다.

문제의 원인 확인

CodeQL 워크플로에서 다음 라인을 확인합니다. 이러한 줄은 CodeQL 워크플로의 초기 버전에서 Analyze 작업의 steps 섹션에 포함되어 있었습니다.

        with:
          # We must fetch at least the immediate parents so that if this is
          # a pull request then we can checkout the head.
          fetch-depth: 2

      # If this run was triggered by a pull request event, then checkout
      # the head of the pull request instead of the merge commit.
      - run: git checkout HEAD^2
        if: ${{ github.event_name == 'pull_request' }}

문제 해결

CodeQL 워크플로에서 해당 라인을 제거합니다. 워크플로의 수정된 steps 섹션은 다음과 같아야 합니다.

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      # Initializes the CodeQL tools for scanning.
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3

      ...

CodeQL 워크플로 파일을 편집하는 방법에 대한 자세한 정보는 "코드 검사를 위한 고급 설정사용자 지정"을 참조하세요.