{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "customDatasources": {
    "grafana-dashboards": {
      "defaultRegistryUrlTemplate": "https://grafana.com/api/dashboards/{{packageName}}",
      "format": "json",
      "transformTemplates": [
        "{\"releases\":[{\"version\": $string(revision)}]}"
      ]
    }
  },
  "customManagers": [
    {
      "customType": "regex",
      "description": ["Process Grafana dashboards"],
      "fileMatch": ["(^|/)kubernetes/.+\\.ya?ml(?:\\.j2)?$"],
      "matchStrings": [
        "depName=\"(?<depName>.*)\"\\n(?<indentation>\\s+)gnetId: (?<packageName>\\d+)\\n.+revision: (?<currentValue>\\d+)"
      ],
      "autoReplaceStringTemplate": "depName=\"{{{depName}}}\"\n{{{indentation}}}gnetId: {{{packageName}}}\n{{{indentation}}}revision: {{{newValue}}}",
      "datasourceTemplate": "custom.grafana-dashboards",
      "versioningTemplate": "regex:^(?<major>\\d+)$"
    }
  ],
  "packageRules": [
    {
      "addLabels": ["renovate/grafana-dashboard"],
      "automerge": true,
      "automergeType": "branch",
      "matchDatasources": ["custom.grafana-dashboards"],
      "matchUpdateTypes": ["major"],
      "semanticCommitType": "chore",
      "semanticCommitScope": "grafana-dashboards",
      "commitMessageTopic": "dashboard {{depName}}",
      "commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
    }
  ]
}