attzonko/mmpy_bot

View on GitHub
.github/workflows/pre-commit-autoupdate.yml

Summary

Maintainability
Test Coverage
name: Pre-commit auto-update

on:
  # every day at midnight
  schedule:
    - cron: "0 0 * * *"
  # on demand  
  workflow_dispatch:

jobs:
  auto-update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Configure Python 3.10
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'

      - name: Use Pip cache if available
        uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip3-${{ hashFiles('*requirements.txt') }}
      - name: Install wheel package
        run: pip install wheel

      - name: Install dependencies (including pytype)
        # needed to install pytype
        run: pip install -e .[dev]

      - name: Update and validate pre-commit updates
        uses: browniebroke/pre-commit-autoupdate-action@main

      - name: Create Pull request with pre-commit updates
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          branch: update/pre-commit-hooks
          title: Update pre-commit hooks
          commit-message: "CI: update pre-commit hooks"
          body: Update versions of pre-commit hooks to latest version.