---
name: "Refresh docs build dependencies"
"on":
  schedule:
    # Weekly
    - cron: "0 0 * * 0"
  workflow_dispatch:
    inputs:
      base-branch:
        required: false
        type: string
      pr-branch:
        required: false
        type: string
      reset-branch:
        type: boolean
        default: false
      labels:
        required: false
        type: string
      python-version:
        description: >-
          Python version to use to compile the dependencies.
          Must be correctly chosen for every stable branch.
        type: string
        default: "3.12"

permissions:
  contents: read

jobs:
  refresh:
    name: "Refresh docs build dependencies"
    uses: ./.github/workflows/reusable-pip-compile.yml
    with:
      message: "ci: refresh docs build dependencies"
      base-branch: "${{ inputs.base-branch || 'devel' }}"
      pr-branch: "${{ inputs.pr-branch || 'pip-compile/devel/docs' }}"
      nox-args: >-
        -e
        'pip-compile(requirements)'
      reset-branch: "${{ inputs.reset-branch || false }}"
      labels: "${{ inputs.labels || 'doc builds,no_backport' }}"
      python-versions: "${{ inputs.python-version }}"
    # 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 }}"
