From 5d7157f692ed6708da7fad6843bc2e43aa4365f8 Mon Sep 17 00:00:00 2001 From: James Melvin Ebenezer Date: Tue, 9 Apr 2024 21:31:56 +0530 Subject: [PATCH] Update pre-commit.yml --- .github/workflows/pre-commit.yml | 45 ++++++++++++-------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7e10f25..6473542 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,34 +1,21 @@ -name: pre-commit - +name: Lint on: - workflow_call: - pull_request_target: - + pull_request: + branches: + - main + push: + branches: + - main jobs: - pre-commit: + lint: runs-on: ubuntu-latest steps: - # in case of PR, check out the PR's head branch - - uses: actions/checkout@v4 - if: github.event_name == 'pull_request_target' - with: - ref: ${{ github.event.pull_request.head.sha }} - # in case of push, check out the main branch - - uses: actions/checkout@v4 - if: github.event_name != 'pull_request_target' - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: "pip" - - run: pip install -r requirements.txt - - uses: pre-commit/action@v3.0.1 - - name: Post PR comment on failure - if: failure() && github.event_name == 'pull_request_target' - uses: peter-evans/create-or-update-comment@v4 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - :x: **pre-commit** failed. - Please run `pre-commit run --all-files` locally and commit the changes. - Find more information in the repository's CONTRIBUTING.md + - name: Set up Git repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + + - name: Pre-Commit Checks + uses: pre-commit/action@v3.0.0