Skip to content

Commit

Permalink
add a auto merge pre-commit yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SaranjeetKaur committed Oct 26, 2024
1 parent 6b9a30d commit 3822a22
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Pre-commit and Auto Merge

on:
push:
branches:
- '**' # This will trigger on pushes to any branch
pull_request:
branches:
- '**' # This will trigger on PRs to any branch

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

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8' # Set the version you need

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: |
pre-commit run --all-files
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add .
- name: Commit changes
run: git commit -m "Apply pre-commit changes" || echo "No changes to commit"

- name: Merge changes
run: |
# Check if there are changes to push
if [ -n "$(git status --porcelain)" ]; then
git push origin "${{ github.ref }}"
else
echo "No changes to push."
fi

0 comments on commit 3822a22

Please sign in to comment.