I am trying to setup GitHub Action that should only run on .py file in the pull request. Suppose if I am pushing any other file (say .txt) it should skip the workflow run and allow me to merge the pull request despite it is on protected branch rule for required checks.(I have added a branch protection rule so that the pull request should only get merged once the status checks have passed).
I have added path to just run the checks on files with .py extension but this halts the check in pending state for non python files and the pull request can never be merged
name: Linter
on:
push:
branches: [main]
pull_request:
paths:
- '**.py'
workflow_dispatch:
jobs:
linter:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint with Pylint
run: |
flake8 $(git diff origin/main --name-only --diff-filter=d)