name: Fixups

on:
  workflow_dispatch:
  push: 
    branches:
      - main

jobs:
  fixup:
    name: Format and fix lints
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          ssh-key: ${{ secrets.AUTOCOMMIT_KEY }}
      - uses: actions-rs/toolchain@v1
        with: { toolchain: stable }
      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: check
      - uses: actions-rs/cargo@v1
        with: { command: fix, args: --locked --workspace }
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v7
        with:
          commit_message: "🚨 Fix lints"
      - uses: actions-rs/cargo@v1
        with: { command: fmt, args: --all }
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v7
        with:
          commit_message: "🎨 Format code"
