# Aviso: "1 problema foi detectado com este fluxo de trabalho: git checkout HEAD^2 não é mais necessário"

Se você receber esse aviso, deve atualizar seu fluxo de trabalho para seguir as melhores práticas atuais.

## Sobre este aviso

```text
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.
```

Se você estiver usando um fluxo de trabalho antigo CodeQL , poderá receber esse aviso da ação "Inicializar CodeQL".

## Confirmar a causa do problema

Verifique as linhas a seguir do CodeQL fluxo de trabalho. Essas linhas foram incluídas na `steps` seção da `Analyze` tarefa nas versões iniciais do CodeQL fluxo de trabalho.

```yaml
        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' }}
```

## Corrigir o problema

Remova as linhas do CodeQL fluxo de trabalho. Agora, a seção revisada `steps` do fluxo de trabalho terá esta aparência:

```yaml
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

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

      # ...
```