name: PR dependabot go modules fix

# This action runs on PRs opened by dependabot and updates modules.
on:
  pull_request:
    branches:
      - dependabot/**
  push:
    branches:
      - dependabot/**
  workflow_dispatch:

permissions:
  contents: write # Allow to update the PR.

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # tag=v4.1.3
    - name: Set up Go
      uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # tag=v5.0.0
      with:
        go-version: '1.22'
    - name: Update all modules
      run: make modules
    - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # tag=v9.1.4
      name: Commit changes
      with:
        author_name: dependabot[bot]
        author_email: 49699333+dependabot[bot]@users.noreply.github.com
        default_author: github_actor
        message: 'Update generated code'