Skip to content

Commit

Permalink
Allow linter to run on main, PR changes instead of direct push on main
Browse files Browse the repository at this point in the history
  • Loading branch information
kjy5 committed Mar 21, 2024
1 parent 400ca67 commit aa5dc46
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/autoformat-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Autoformat and Lint

on:
pull_request:
# push:
# branches:
# - main
push:
branches:
- main
merge_group:

jobs:
Expand Down Expand Up @@ -35,11 +35,22 @@ jobs:
run: hatch fmt -f

- name: ✅ Commit code format changes
if: github.ref != 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Autoformat code"
skip_fetch: true
skip_checkout: true

- name: 📤 PR code format changes
if: github.ref == 'refs/heads/main'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PR_TOKEN }}
commit-message: "Autoformat code"
title: "chore: Autoformat code"
branch: "autoformat-code"
delete-branch: true

- name: 🔍 Lint
run: hatch fmt --check

0 comments on commit aa5dc46

Please sign in to comment.