name: examples

on:
  push:
    branches:
      - 'main'
    paths:
      - '.github/workflows/examples.yml'
      - './examples/go.mod'
      - './examples/go.sum'
      - './go.mod'
      - './go.sum'
  workflow_dispatch: {}

jobs:
  tidy:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v4
        with:
          go-version: '^1'
          cache: true
      - shell: bash
        run: |
          (cd ./examples && go mod tidy)
      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: "chore: go mod tidy examples"
          branch: main
          commit_user_name: actions-user
          commit_user_email: actions@github.com


