name: lint with pre-commit

on:
  pull_request:
  push:
    branches:
      - main
    tags:
      - '*'

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash -el {0}
    steps:
      - name: Checkout
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - name: Setup Miniconda
        uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
        with:
          auto-update-conda: true
          auto-activate-base: false
      - name: Install pre-commit
        run: conda install -c conda-forge pre-commit
      - name: Lint code with pre-commit
        run: pre-commit run --verbose --all-files
