From 1b58fd61239ebc790e83fadb80d51c7f948c753e Mon Sep 17 00:00:00 2001 From: hadifawaz1999 Date: Sun, 21 Jul 2024 14:09:32 +0200 Subject: [PATCH] update workflow --- .github/workflows/pre-commit.yml | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 11edf02..8a25d9e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,16 +1,34 @@ name: pre-commit on: - pull_request: push: - branches: [main] + branches: + - main + pull_request_target: + branches: + - main jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Get changed files + uses: tj-actions/changed-files@v44 + id: changed-files + + - name: List changed files + run: echo '${{ steps.changed-files.outputs.all_changed_files }}' + + - name: Local pre-commit + uses: pre-commit/action@v3.0.1 with: - extra_args: flake8 --all-files \ No newline at end of file + extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }} + \ No newline at end of file