{"meta":{"title":"警告: \"このワークフローで 1 つの問題が検出されました: git checkout HEAD^2 は不要になりました\"","intro":"この警告が表示された場合は、現在のベスト プラクティスに従ってワークフローを更新する必要があります。","product":"セキュリティとコードの品質","breadcrumbs":[{"href":"/ja/code-security","title":"セキュリティとコードの品質"},{"href":"/ja/code-security/reference","title":"リファレンス"},{"href":"/ja/code-security/reference/code-scanning","title":"コード スキャン"},{"href":"/ja/code-security/reference/code-scanning/troubleshoot-analysis-errors","title":"分析エラーのトラブルシューティング"},{"href":"/ja/code-security/reference/code-scanning/troubleshoot-analysis-errors/unnecessary-step-found","title":"不要なステップが見つかった"}],"documentType":"article"},"body":"# 警告: \"このワークフローで 1 つの問題が検出されました: git checkout HEAD^2 は不要になりました\"\n\nこの警告が表示された場合は、現在のベスト プラクティスに従ってワークフローを更新する必要があります。\n\n## この警告について\n\n```text\nWarning: 1 issue was detected with this workflow: git checkout HEAD^2 is no longer\nnecessary. Please remove this step as Code Scanning recommends analyzing the merge\ncommit for best results.\n```\n\n古い CodeQL ワークフローを使用している場合は、[ CodeQLの初期化] アクションからこの警告を受け取ることがあります。\n\n## 問題の原因を確認する\n\nCodeQL ワークフローの次の行を確認します。 これらの行は、`steps` ワークフローの初期バージョンの`Analyze` ジョブのCodeQL セクションに含まれていました。\n\n```yaml\n        with:\n          # We must fetch at least the immediate parents so that if this is\n          # a pull request then we can checkout the head.\n          fetch-depth: 2\n\n      # If this run was triggered by a pull request event, then checkout\n      # the head of the pull request instead of the merge commit.\n      - run: git checkout HEAD^2\n        if: ${{ github.event_name == 'pull_request' }}\n```\n\n## 問題を修正する\n\nCodeQL ワークフローから行を削除します。 ワークフローの変更された `steps` セクションは次のようになるはずです。\n\n```yaml\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v6\n\n      # Initializes the CodeQL tools for scanning.\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v4\n\n      # ...\n```"}