forked from phoenix-oss/llama-stack-mirror
Switch to pre-commit/action (#239)
This commit is contained in:
parent
05282d1234
commit
a2b87ed0cb
1 changed files with 1 additions and 24 deletions
25
.github/workflows/pre-commit.yml
vendored
25
.github/workflows/pre-commit.yml
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue