From a2b87ed0cb5be83022e13f99bf0b5c17a6524072 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Fri, 11 Oct 2024 14:09:11 -0400 Subject: [PATCH] Switch to pre-commit/action (#239) --- .github/workflows/pre-commit.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 871e91f4a..dd1a5c6cd 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,27 +22,4 @@ jobs: **/requirements*.txt .pre-commit-config.yaml - - name: Install pre-commit - run: | - python -m pip install --upgrade pip - pip install pre-commit - - - name: Fetch base branch - run: git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} - - - name: Fetch head commit from PR - run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} - - - name: Get changed files - id: changed-files - run: | - git diff --name-only origin/${{ github.event.pull_request.base.ref }} pr-${{ github.event.pull_request.number }} > changed_files.txt - cat changed_files.txt - - - name: Run pre-commit - run: | - if [ -s changed_files.txt ]; then - pre-commit run --files $(cat changed_files.txt | tr '\n' ' ') - else - echo "No changed files to run pre-commit on." - fi + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1