Skip to content

Commit

Permalink
Only run CodeQL python if the PR contains changed files that are python
Browse files Browse the repository at this point in the history
Ticket: #7358
  • Loading branch information
Nancyenos committed Nov 26, 2024
1 parent 13841c0 commit 383c713
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,24 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

# Check if Python files are changed
- name: Check for Python file changes
id: python_check
run: |
git fetch origin ${{ github.base_ref }}
git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep '^python/' || echo "no-python-changes"
continue-on-error: true

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.27.0
with:
languages: ${{ matrix.language }}
queries: security-extended

if: |
(matrix.language == 'cpp') ||
(matrix.language == 'python' && steps.python_check.outputs.result != 'no-python-changes')
- run: |
sudo apt-get update
sudo apt-get install libyaml-dev
Expand Down

0 comments on commit 383c713

Please sign in to comment.