name: Go formatting
on:
  push:
    branches: [ main ]
    paths:
      - '**.go'

jobs:
  go-formatting:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Go
        uses: actions/setup-go@v5
        with:
          go-version: 'stable'

      - name: Run make format
        run: make format

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v7
        with:
          title: "chore: go formatting"
          commit-message: "chore: go formatting"
          body: ""
          branch: chore/go-formatting
