Look for successful builds of plugins without a stable branch

Fix a problem with the logic of the auto-generation of the
plugins page: if a plugin doesn't have a stable branch it should
still look for a successful build.

Bug: Issue 12658
Change-Id: I039e82d4d853c585fe74c07b9dcb27c678e7ba03
diff --git a/tools/plugins.py b/tools/plugins.py
index 65106dc..99058a2 100644
--- a/tools/plugins.py
+++ b/tools/plugins.py
@@ -243,20 +243,19 @@
         pluginBranches = self._get_branches(pluginId)
         branches = list()
         for branch in BRANCHES:
-            if branch in pluginBranches:
-                string = fr"^plugin-{pluginName}[\w|-]*-{branch}$"
-                pattern = re.compile(string)
-                result = BuildResult.UNAVAILABLE
-                for job in builds["jobs"]:
-                    if pattern.match(job["name"]):
-                        result = (
-                            BuildResult.SUCCESSFUL
-                            if job["lastBuild"]["result"] == "SUCCESS"
-                            else BuildResult.FAILED
-                        )
-                        break
-                branches.append(Branch(branch, result))
-            else:
+            string = fr"^plugin-{pluginName}-[a-z|-]*{branch}$"
+            pattern = re.compile(string)
+            result = BuildResult.UNAVAILABLE
+            for job in builds["jobs"]:
+                if pattern.match(job["name"]):
+                    result = (
+                        BuildResult.SUCCESSFUL
+                        if job["lastBuild"] and job["lastBuild"]["result"] == "SUCCESS"
+                        else BuildResult.FAILED
+                    )
+                    branches.append(Branch(branch, result, branch in pluginBranches))
+                    break
+            if result == BuildResult.UNAVAILABLE:
                 branches.append(Branch.missing(branch))
         return branches