Skip to main content

GitHub AE est actuellement en version limitée.

Avertissement : « 1 problème a été détecté avec ce workflow : git checkout HEAD^2 n’est plus nécessaire »

Si cet avertissement se produit, mettez à jour votre workflow de façon à suivre les meilleures pratiques actuelles.

Si vous utilisez un ancien workflow CodeQL, vous pouvez recevoir l’avertissement suivant dans la sortie de l’action « Initialiser Initialize 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.

Pour corriger cela, supprimez les lignes suivantes du workflow CodeQL. Ces lignes ont été incluses dans la section steps du travail Analyze dans les versions initiales du workflow CodeQL.

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

La section steps révisée du flux de travail doit ressembler à ceci :

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

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

      ...

Pour plus d’informations sur la modification du fichier de workflow CodeQL, consultez « Personnalisation de l’analyse du code ».