name: go-updater

on:
  schedule:
    - cron: '0 12 * * *'
  workflow_dispatch:

jobs:
  update-go:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Set up Go 1.x
        uses: actions/setup-go@v5
        with:
          go-version: 'stable'
          check-latest: true
      - name: Update Go
        run: go get go
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.CARVEL_BOT_ACCESS_TOKEN }}
          committer: Carvel Bot <svc.bot.carvel@vmware.com>
          author: Carvel Bot <svc.bot.carvel@vmware.com>
          commit-message: |
            Bump go
            
            Signed-off-by: Carvel Bot <svc.bot.carvel@vmware.com>
          title: Bump go
          delete-branch: true
          body: |
            Auto-generated by https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
            Signed-off-by: Carvel Bot <svc.bot.carvel@vmware.com>
          base: develop
          branch: bump-go
