name: Fixups

on:
  workflow_dispatch:
  push: 
    branches:
      - main

jobs:
  fixup:
    name: Format and fix lints
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ssh-key: ${{ secrets.AUTOCOMMIT_KEY }}
      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: check

      - run: cargo fix --locked --workspace
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v7
        with:
          commit_message: "🚨 Fix lints"
          
      - run: cargo fmt --all 
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v7
        with:
          commit_message: "🎨 Format code"
