---
name: "Refresh dev dependencies"
"on":
  schedule:
    # Weekly
    - cron: "0 0 * * 0"
  workflow_dispatch:
    inputs:
      reset-branch:
        type: boolean
        default: false
      labels:
        required: false
        type: string

permissions:
  contents: read

jobs:
  refresh:
    strategy:
      fail-fast: false
      matrix:
        include:
          - base-branch: devel
            pr-branch: pip-compile/devel/dev
            nox-args: >-
              -e 'pip-compile(formatters)'
              'pip-compile(typing)'
              'pip-compile(static)'
              'pip-compile(spelling)'
              'pip-compile(tag)'
              'pip-compile(pip-compile)'
            python-versions: "3.12"
          - base-branch: stable-2.20
            pr-branch: pip-compile/stable-2.20/dev
            nox-args: >-
              -e 'pip-compile(formatters)'
              'pip-compile(typing)'
              'pip-compile(static)'
              'pip-compile(spelling)'
            python-versions: "3.12"
          - base-branch: stable-2.19
            pr-branch: pip-compile/stable-2.19/dev
            nox-args: >-
              -e 'pip-compile(formatters)'
              'pip-compile(typing)'
              'pip-compile(static)'
              'pip-compile(spelling)'
            python-versions: "3.11"
          - base-branch: stable-2.18
            pr-branch: pip-compile/stable-2.18/dev
            nox-args: >-
              -e 'pip-compile(formatters)'
              'pip-compile(typing)'
              'pip-compile(static)'
              'pip-compile(spelling)'
            python-versions: "3.11"
    name: "Refresh dev dependencies"
    uses: ./.github/workflows/reusable-pip-compile.yml
    with:
      message: "ci: refresh dev dependencies"
      base-branch: "${{ matrix.base-branch }}"
      pr-branch: "${{ matrix.pr-branch }}"
      nox-args: "${{ matrix.nox-args }}"
      python-versions: "${{ matrix.python-versions }}"
      reset-branch: "${{ inputs.reset-branch || false }}"
      labels: "${{ inputs.labels || 'no_backport,tooling' }}"
    # Pass using inherit, as this seems to be the only possible way to access
    # secrets defined in an enviornment when using nested workflows.
    secrets: inherit  # zizmor: ignore[secrets-inherit]
    # secrets:
    #   BOT_APP_ID: "${{ secrets.BOT_APP_ID }}"
    #   BOT_APP_KEY: "${{ secrets.BOT_APP_KEY }}"
