Skip to content

DEVOPS-1086: Adding logic to run Pylint on all files when env files changes#206

Open
RomFloreani wants to merge 9 commits into
mainfrom
DEVOPS-1086
Open

DEVOPS-1086: Adding logic to run Pylint on all files when env files changes#206
RomFloreani wants to merge 9 commits into
mainfrom
DEVOPS-1086

Conversation

@RomFloreani

@RomFloreani RomFloreani commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

DEVOPS-1086 - In CI-Tools, force Pylint on all files if environment lock has changed

Copilot AI review requested due to automatic review settings July 9, 2026 18:33
@github-actions github-actions Bot changed the title Adding logic to run Pylint on all files when env files changes DEVOPS-1086: Adding logic to run Pylint on all files when env files changes Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the reusable Python static analysis GitHub Actions workflow to force running Pylint across the full codebase when an environment lock file changes, instead of limiting linting to only modified Python files in pull requests.

Changes:

  • Detects lock-file changes based on the selected package manager (pixi/poetry/conda) during PR runs.
  • Falls back to linting only modified Python files when no relevant lock file has changed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +133 to +142
changed_files=$(git diff --diff-filter=AM --name-only refs/remotes/origin/${GITHUB_BASE_REF}... --)
if [ -n "$LOCK_FILE" ] && echo "$changed_files" | grep -qxF "$LOCK_FILE"; then
echo "Lock file '$LOCK_FILE' changed: forcing Pylint to run on all files"
else
{
echo 'FILES_PARAM<<_EOF_'
echo "$changed_files" | grep -E "^(${source_dir}|tests)/.*\.py$" || true
echo '_EOF_'
} >> $GITHUB_ENV
fi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a separate unfiltered changed_files_all diff for the lock-file check so a genuine deletion is caught, while keeping the AM filter for the pylint file list.

@RomFloreani
RomFloreani requested a review from sebhmg July 10, 2026 13:18

@sebhmg sebhmg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see suggestions and questions

Comment thread .github/workflows/reusable-python-static_analysis.yml Outdated
Comment thread .github/workflows/reusable-python-static_analysis.yml Outdated
Comment thread .github/workflows/reusable-python-static_analysis.yml Outdated
Comment on lines 289 to 290

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought: the existing logic is not quite right here

If in a PR and there are not files changes, there is just no need to run pylint

Instead should likely have something like:

- name: Pylint skipped
        if: ${{ (github.event_name == 'pull_request') && !env.FILES_PARAM }}
        run: echo "::notice::Pylint skipped: no applicable file changes detected."

- name: Run Pylint on modified files
        if: ${{ (github.event_name == 'pull_request') && env.FILES_PARAM }}
        run: ...

- name: Run Pylint on all files
        if: ${{ (github.event_name != 'pull_request') }}
        run: ...

@RomFloreani
RomFloreani requested a review from sebhmg July 10, 2026 20:42
sebhmg
sebhmg previously approved these changes Jul 14, 2026
@RomFloreani

Copy link
Copy Markdown
Contributor Author

@sebhmg
Created this branch in InSight, it is passing the transaltion tool pylint. Is this the expected behavior?

Link to run:
https://github.com/MiraGeoscience/InSight/actions/runs/29419993850/job/87367704193?pr=5992

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants