Skip to content

Commit

Permalink
fix: change lint workflow to automatically commit linting (#28782)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Armstrong authored Jun 30, 2024
1 parent 48e312d commit cc345c0
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: lint

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 4 * * *"

permissions:
contents: write

jobs:
check-formatting:
lint-code:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️ ${{ github.event.repository.name }}
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4

- name: Get changed files
Expand All @@ -23,12 +22,29 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python 🐍
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.10.14

- name: Run pre-commit 🚀
- name: Run pre-commit
continue-on-error: true
uses: pre-commit/action@v3.0.0
with:
extra_args: ${{ github.event_name == 'pull_request' && format('--files {0}', join(fromJSON(steps.changed-files.outputs.all), ' ')) || '--all-files' }}

- name: Check if there are changes
id: check
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.check.outputs.changes == 'true'
run: |
git config --local user.email "hello@transpile-ai.com"
git config --local user.name "ivy-dev-bot"
git add .
git commit -m "auto-lint code"
git push

0 comments on commit cc345c0

Please sign in to comment.