이전 CodeQL 워크플로를 사용하는 경우 “CodeQL” 작업의 출력에서 다음과 같은 경고가 나타날 수 있습니다.
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 워크플로의 초기 버전에서 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' }}
워크플로의 수정된 steps
섹션은 다음과 같습니다.
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
...
CodeQL 워크플로 파일 편집에 대한 자세한 내용은 "코드 검사를 위한 고급 설정사용자 지정"을 참조하세요.