{
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": ["config:recommended", "replacements:all"],
    "osvVulnerabilityAlerts": true,
    "lockFileMaintenance": {
        "enabled": true,
        "schedule": ["at any time"]
    },
    "platformAutomerge": true,
    "nix": {
        "enabled": true
    },
    "labels": ["Dependencies", "Dependencies/Renovate"],
    "ignoreDeps": [
        "tikv-jemallocator",
        "tikv-jemalloc-sys",
        "tikv-jemalloc-ctl",
        "opentelemetry",
        "opentelemetry_sdk",
        "opentelemetry-jaeger",
        "tracing-opentelemetry"
    ],
    "github-actions": {
        "enabled": true,
        "managerFilePatterns": [
            "/(^|/)\\.forgejo/workflows/[^/]+\\.ya?ml$/",
            "/(^|/)\\.forgejo/actions/[^/]+/action\\.ya?ml$/",
            "/(^|/)\\.github/workflows/[^/]+\\.ya?ml$/",
            "/(^|/)\\.github/actions/[^/]+/action\\.ya?ml$/"
        ]
    },
    "packageRules": [
        {
            "description": "Batch patch-level Rust dependency updates",
            "matchManagers": ["cargo"],
            "matchUpdateTypes": ["patch"],
            "groupName": "rust-patch-updates"
        },
        {
            "description": "Limit concurrent Cargo PRs",
            "matchManagers": ["cargo"],
            "prConcurrentLimit": 5
        },
        {
            "description": "Group Rust toolchain updates into a single PR",
            "matchManagers": ["custom.regex"],
            "matchPackageNames": ["rust", "rustc", "cargo"],
            "groupName": "rust-toolchain"
        },
        {
            "description": "Batch minor and patch GitHub Actions updates",
            "matchManagers": ["github-actions"],
            "matchUpdateTypes": ["minor", "patch"],
            "groupName": "github-actions-non-major"
        },
        {
            "description": "Pin forgejo artifact actions to prevent breaking changes",
            "matchManagers": ["github-actions"],
            "matchPackageNames": ["forgejo/upload-artifact", "forgejo/download-artifact"],
            "enabled": false
        },
        {
            "description": "Auto-merge renovatebot docker image updates",
            "matchDatasources": ["docker"],
            "matchPackageNames": ["ghcr.io/renovatebot/renovate"],
            "automerge": true,
            "automergeStrategy": "fast-forward"
        },
        {
            "description": "Group lockfile updates into a single PR",
            "matchUpdateTypes": ["lockFileMaintenance"],
            "groupName": "lockfile-maintenance"
        }
    ],
    "customManagers": [
       {
         "customType": "regex",
         "description": "Update _VERSION variables in Dockerfiles",
         "managerFilePatterns": [
           "/(^|/)([Dd]ocker|[Cc]ontainer)file[^/]*$/",
           "/(^|/|\\.)([Dd]ocker|[Cc]ontainer)file$/"
         ],
         "matchStrings": [
           "# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s+(?:ENV|ARG)\\s+[A-Za-z0-9_]+?_VERSION[ =][\"']?(?<currentValue>.+?)[\"']?\\s"
         ]
       }
    ]
}
