{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:best-practices",
    ":approveMajorUpdates",
    ":maintainLockFilesWeekly",
    "group:postcss",
    "group:linters",
    "schedule:daily",
    "schedule:automergeDaily",
    "local>forgejo-contrib/forgejo-renovate//go.json"
  ],
  "ignorePresets": [
    ":semanticPrefixFixDepsChoreOthers",
    "docker:pinDigests",
    "helpers:pinGitHubActionDigests"
  ],
  "baseBranches": [
    "$default",
    "/^v[7-9]\\.\\d+/forgejo$/",
    "/^v\\d\\d+\\.\\d+\\/forgejo$/"
  ],
  "semanticCommits": "disabled",
  "automergeStrategy": "merge-commit",
  "postUpdateOptions": [
    "gomodTidy",
    "gomodUpdateImportPaths",
    "npmDedupe"
  ],
  "prConcurrentLimit": 10,
  "internalChecksFilter": "strict",
  "osvVulnerabilityAlerts": true,
  "labels": [
    "dependency-upgrade"
  ],
  "packageRules": [
    {
      "description": "Require approval for go and python minor version",
      "matchDepNames": [
        "go",
        "python",
        "golang",
        "docker.io/golang",
        "docker.io/library/golang",
        "mcr.microsoft.com/devcontainers/go"
      ],
      "matchUpdateTypes": [
        "minor"
      ],
      "dependencyDashboardApproval": true
    },
    {
      "description": "Require dashboard approval for some deps",
      "matchDepNames": [
        "bitnami/minio",
        "github.com/go-ap/activitypub",
        "github.com/nektos/act",
        "gitea.com/gitea/act"
      ],
      "dependencyDashboardApproval": true
    },
    {
      "description": "Schedule some deps less frequently",
      "matchDepNames": [
        "github.com/google/pprof",
        "github.com/golangci/misspell/cmd/misspell"
      ],
      "extends": [
        "schedule:quarterly"
      ]
    },
    {
      "description": "elasticsearch CI images are published about once a month and do not use semantic versioning or short tags",
      "matchDepNames": [
        "elasticsearch"
      ],
      "extends": [
        "schedule:quarterly"
      ]
    },
    {
      "description": "devcontainer is an optional tool used by some Forgejo contributors when working on the codebase",
      "groupName": "devcontainer packages",
      "extends": [
        "schedule:quarterly"
      ],
      "automerge": true,
      "matchPackageNames": [
        "ghcr.io/devcontainers/features/**",
        "ghcr.io/devcontainers-contrib/features/**"
      ]
    },
    {
      "description": "Group golang packages",
      "matchDepNames": [
        "go",
        "golang",
        "docker.io/golang",
        "docker.io/library/golang"
      ],
      "groupName": "golang packages"
    },
    {
      "description": "Group nodejs packages",
      "matchDepNames": [
        "node",
        "docker.io/node",
        "docker.io/library/node"
      ],
      "groupName": "nodejs packages",
      "versionCompatibility": "^(?<version>[^-]+)(?<compatibility>-.*)?$",
      "versioning": "node"
    },
    {
      "description": "x/tools/* are used in the CI only and upgraded together",
      "matchUpdateTypes": [
        "minor",
        "patch",
        "digest"
      ],
      "automerge": true,
      "groupName": "x/tools",
      "matchPackageNames": [
        "golang.org/x/tools{/,}**"
      ]
    },
    {
      "description": "Split minor and patch updates",
      "matchDepNames": [
        "docker.io/golang",
        "docker.io/library/golang",
        "github.com/urfave/cli/v2",
        "go",
        "golang",
        "python",
        "swagger-ui-dist",
        "vue"
      ],
      "separateMinorPatch": true
    },
    {
      "description": "Automerge patch updates",
      "matchDepNames": [
        "vue",
        "github.com/urfave/cli/v2",
        "swagger-ui-dist"
      ],
      "matchUpdateTypes": [
        "patch"
      ],
      "automerge": true
    },
    {
      "description": "Automerge renovate updates",
      "matchDatasources": [
        "docker"
      ],
      "matchPackageNames": [
        "code.forgejo.org/forgejo-contrib/renovate",
        "ghcr.io/visualon/renovate"
      ],
      "matchUpdateTypes": [
        "minor",
        "patch",
        "digest"
      ],
      "automerge": true
    },
    {
      "description": "Add reviewer and additional labels to renovate PRs",
      "matchDatasources": [
        "docker"
      ],
      "matchPackageNames": [
        "code.forgejo.org/forgejo-contrib/renovate",
        "ghcr.io/visualon/renovate"
      ],
      "reviewers": ["viceice"],
      "addLabels": ["forgejo/ci", "test/not-needed"]
    },
    {
      "description": "Update renovate with higher prio to come through rate limit",
      "matchDatasources": [
        "docker"
      ],
      "matchPackageNames": [
        "code.forgejo.org/forgejo-contrib/renovate",
        "ghcr.io/visualon/renovate"
      ],
      "extends": [
        "schedule:weekly"
      ],
      "prPriority": 10,
      "reviewers": ["viceice"],
      "addLabels": ["forgejo/ci", "test/not-needed"],
      "groupName": "renovate"
    },
    {
      "description": "Update go patch with higher prio to come through rate limit",
      "matchDepNames": [
        "go",
        "golang",
        "docker.io/golang",
        "docker.io/library/golang"
      ],
      "matchUpdateTypes": [
        "patch"
      ],
      "prPriority": 10,
      "schedule": [
        "at any time"
      ]
    },
    {
      "description": "Disable actions/cascading-pr for now <https://github.com/renovatebot/renovate/issues/28120>",
      "matchDepNames": [
        "actions/cascading-pr"
      ],
      "matchManagers": [
        "github-actions"
      ],
      "enabled": false
    },
    {
      "description": "Automerge some packages when CI succeeds",
      "extends": [
        "packages:linters",
        "packages:test"
      ],
      "matchDepNames": [
        "github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker",
        "github.com/golangci/golangci-lint/cmd/golangci-lint",
        "github.com/go-testfixtures/testfixtures",
        "github.com/PuerkitoBio/goquery",
        "happy-dom",
        "markdownlint-cli",
        "mvdan.cc/gofumpt",
        "updates",
        "vite-string-plugin",
        "@vue/test-utils"
      ],
      "automerge": true,
      "matchPackageNames": [
        "@eslint-community/**",
        "@playwright/**",
        "@stoplight/spectral-cli",
        "@stylistic/**",
        "mcr.microsoft.com/devcontainers/**"
      ]
    },
    {
      "description": "Hold back on some package updates for a few days",
      "matchDepNames": [
        "monaco-editor"
      ],
      "minimumReleaseAge": "30 days"
    },
    {
      "description": "disallow `eslint-plugin-no-use-extend-native` v0.6.0+, requires eslint v9",
      "matchDepNames": [
        "eslint-plugin-no-use-extend-native"
      ],
      "allowedVersions": "<0.6.0"
    },
    {
      "description": "Require approval for stable branches (must be last rule to override all others)",
      "matchBaseBranches": [
        "/^v\\d+\\.\\d+\\/forgejo$/"
      ],
      "dependencyDashboardApproval": true,
      "schedule": [
        "at any time"
      ]
    }
  ],
  "customManagers": [
    {
      "description": "Update go-version in forgejo workflows",
      "customType": "regex",
      "fileMatch": [
        "^.forgejo/workflows/.+\\.yml$"
      ],
      "matchStrings": [
        "\\s+go-version: ['\"]?(?<currentValue>.+?)['\"]?\\s"
      ],
      "depNameTemplate": "go",
      "datasourceTemplate": "golang-version",
      "versioningTemplate": "go-mod-directive"
    },
    {
      "description": "Update node-version in forgejo workflows",
      "customType": "regex",
      "fileMatch": [
        "^.forgejo/workflows/.+\\.yml$"
      ],
      "matchStrings": [
        "\\s+node-version: ['\"]?(?<currentValue>.+?)['\"]?\\s"
      ],
      "depNameTemplate": "node",
      "datasourceTemplate": "node-version"
    },
    {
      "description": "Update deps inside Makefile",
      "customType": "regex",
      "fileMatch": [
        "^Makefile$"
      ],
      "matchStrings": [
        " \\?= (?<depName>.+?)@(?<currentValue>.+?) # renovate: datasource=(?<datasource>.+?)(?: packageName=(?<packageName>.+?))?( versioning=(?<versioning>.+?))?\\s"
      ]
    }
  ]
}
