name: Mockery
on:
  push:
    branches:
      - main
permissions:
  contents: write
jobs:
  mockery:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          cache: true
          go-version: 'stable'
      - name: Install Mockery
        run: |
          go install github.com/vektra/mockery/v2@latest
      - name: Generate Mocks
        run: |
          ~/go/bin/mockery
          git pull
      - uses: stefanzweifel/git-auto-commit-action@v6
        name: Commit changes
        with:
          commit_message: "chore: update mocks"
