{
  "$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+)id: (?<packageName>\\d+)\\n.+revision: (?<currentValue>\\d+)"
      ],
      "autoReplaceStringTemplate": "depName=\"{{{depName}}}\"\n{{{indentation}}}id: {{{packageName}}}\n{{{indentation}}}revision: {{{newValue}}}",
      "datasourceTemplate": "custom.grafana-dashboards",
      "versioningTemplate": "regex:^(?<major>\\d+)$"
    }
  ],
  "packageRules": [
    {
      "addLabels": ["renovate/grafana-dashboard"],
      "matchDatasources": ["custom.grafana-dashboards"],
      "matchUpdateTypes": ["major"],
      "semanticCommitType": "chore",
      "semanticCommitScope": "grafana-dashboards",
      "commitMessageTopic": "dashboard {{depName}}",
      "commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
    }
  ]
}
