From b4b84f896050cd9b86e74aaf216753cb228a7a75 Mon Sep 17 00:00:00 2001 From: Pierre Malarme Date: Wed, 8 Jul 2026 14:26:35 +0200 Subject: [PATCH] Run CodeQL only on the template repository Repos created from this template don't have code scanning enabled, so the CodeQL analyze/upload step fails and the branch appears to crash. Guard the analyze job to run only on the canonical template repo, which works across all triggers including schedule. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8078251..f6820a5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,6 +23,12 @@ on: jobs: analyze: name: Analyze (${{ matrix.language }}) + # Only run on the canonical template repository. Repos created from this + # template ("Use this template") don't have code scanning enabled, so + # CodeQL's upload would fail and crash the branch. Matching the source repo + # by name works across all triggers, including `schedule` where + # github.event.repository isn't populated. + if: github.repository == 'Azure-Samples/foundry-hosted-agents-workshop' # Runner size impacts CodeQL analysis time. To learn more, please see: # - https://gh.io/recommended-hardware-resources-for-running-codeql # - https://gh.io/supported-runners-and-hardware-resources