-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b9a30d
commit 3822a22
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |