From 41b640fdd6802f4ba3a60070d9fc0192426576ba Mon Sep 17 00:00:00 2001
From: Adam Fidel <ledif@users.noreply.github.com>
Date: Thu, 5 Dec 2024 16:50:44 -0600
Subject: [PATCH] feat(renovate): Add rule for kf6-kio (#54)

* Testing out renovate for kf6

* Rewrite renovate rules for rpms

* Use extractVersionTemplate to only get <major>.<minor>
---
 .github/renovate.json5       | 12 ++++++++++++
 staging/kf6-kio/kf6-kio.spec |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/.github/renovate.json5 b/.github/renovate.json5
index b41fd4a..aebc0cd 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -8,6 +8,18 @@
         "#\\s?renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( extractVersion=(?<extractVersion>.*?))?\\s*Version:\\s*(?<currentValue>.*)\\s"
       ],
       "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
+    },
+    {
+      "customType": "regex",
+      "fileMatch": [".*\\.spec"],
+      "matchStrings": [
+        "# renovate: datasource=yum repo=(?<registryUrl>[^\\s]+) pkg=(?<depName>[^\\s]+)\\s*%global [^\\s]+ (?<currentValue>[^\\s]+)"
+      ],
+      "datasourceTemplate": "npm",
+      "extractVersionTemplate": "^(?<version>\\d\\.\\d)",
+      "versioningTemplate": "loose",
+      "registryUrlTemplate": "https://yum2npm.io/repos/{{replace '/' '/modules/' registryUrl}}/packages"
     }
+
   ]
 }
diff --git a/staging/kf6-kio/kf6-kio.spec b/staging/kf6-kio/kf6-kio.spec
index 569ccb5..9305797 100644
--- a/staging/kf6-kio/kf6-kio.spec
+++ b/staging/kf6-kio/kf6-kio.spec
@@ -1,6 +1,8 @@
 %global framework kio
 
 %global stable_kf6 stable
+
+# renovate: datasource=yum repo=fedora-41-x86_64-updates pkg=kf6-kio
 %global majmin_ver_kf6 6.8
 
 Name:    kf6-%{framework}