Skip to content

Commit

Permalink
Create precommit.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
NTGNguyen authored Dec 5, 2024
1 parent 76a7ff8 commit 0e7317d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Pre-commit Auto Fix

on:
push:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"

- name: Install dependencies
if: ${{ always() }}
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
if: ${{ always() }}
run: pre-commit run --all-files

- name: Create Pull Request
if: ${{ always() }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "🎨 Auto Code Fix (Pre-commit)"
branch: auto/pre-commit-fix
title: "🎨 Auto Code Fix (Pre-commit)"
body: "This pull request contains auto code fixes from pre-commit."
labels: |
auto-fix
pre-commit

0 comments on commit 0e7317d

Please sign in to comment.