name: generate

on:
  push:
    branches:
      - 'main'
    paths:
      - '.github/workflows/generate.yml'
      - pkg/config/config.go
      - CONTRIBUTING.md
      - USERS.md

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@b0e28b5ac45a892f91e7d036f8200cf5ed489415 # v3
        with:
          token: ${{ secrets.GH_PAT }}
      - uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2
        with:
          go-version: 1.18
      - uses: arduino/setup-task@accf38bba955639d21816bb68775e5c48c482182 # v1
      - run: task docs:generate
      - run: task schema:generate
      - uses: stefanzweifel/git-auto-commit-action@5804e42f86b1891093b151b6c4e78e759c746c4d # v4
        with:
          commit_message: "docs: update"
          branch: main
          commit_user_name: actions-user
          commit_user_email: actions@github.com
          commit_author: actions-user <actions@github.com>
