Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Only run CodeQL python if the PR contains changed files that are python #12144

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
paths-ignore:
- "doc/**"
paths:
- "**/*.py" # Trigger workflow only if Python files are changed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL CPP should still have been run and it was not, right ?

schedule:
- cron: '18 21 * * 1'

Expand Down Expand Up @@ -39,8 +39,17 @@ 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 '\.py$' || echo "no-python-changes"
continue-on-error: true

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
if: ${{ steps.python_check.outputs.result != 'no-python-changes' }}
uses: github/codeql-action/[email protected]
with:
languages: ${{ matrix.language }}
Expand All @@ -62,4 +71,5 @@ jobs:
./configure --enable-warnings
make
- name: Perform CodeQL Analysis
if: ${{ steps.python_check.outputs.result != 'no-python-changes' }}
uses: github/codeql-action/[email protected]
Loading