From d791927223d8cb8076eb110b6f7f8d38cbe4e87c Mon Sep 17 00:00:00 2001 From: Mir Ruwayd Afeef <109923578+ruwayd99@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:59:05 -0800 Subject: [PATCH] Create post_commit.yml --- .github/workflows/post_commit.yml | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/post_commit.yml diff --git a/.github/workflows/post_commit.yml b/.github/workflows/post_commit.yml new file mode 100644 index 0000000..d9dc8c1 --- /dev/null +++ b/.github/workflows/post_commit.yml @@ -0,0 +1,32 @@ +name: Pylint Post-Commit + +on: [push] + +jobs: + post-commit: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v11.5 + - name: Check for style using pylint (post-commit) + run: | + for file in ${{ steps.changed-files.outputs.all_modified_files }}; do + if [[ -f $file && $file == *.py ]]; then + echo $file + pylint --disable=all --enable=style $file + autopep8 --in-place --aggressive $file + fi + done