From c02cb9c8e8ee7582a4c00e84c5e81906b179ae84 Mon Sep 17 00:00:00 2001
From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com>
Date: Tue, 3 Dec 2024 19:07:27 +0100
Subject: [PATCH] ci: Fix publish-release not respecting all includes

---
 .github/workflows/publish-release.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
index ddb124c..b59bc2d 100644
--- a/.github/workflows/publish-release.yml
+++ b/.github/workflows/publish-release.yml
@@ -58,8 +58,8 @@ jobs:
           script: |
             const fs = require('fs');
             const settingsGradle = fs.readFileSync('settings.gradle', 'utf8');
-            const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*["']([^"']+)["']\s*\)/gm;
-            const includes = [...settingsGradle.matchAll(includePattern)].map(match => match[1]);
+            const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*(['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])*\s*)\)/gm;
+            const includes = [...settingsGradle.matchAll(includePattern)].flatMap(match => match[0].match(/['"]([^'"]+)['"]/g).map(item => item.replace(/['"]/g, '')));
             const includeFabric = includes.includes('fabric') && ${{inputs.fabric}};
             const includeForge = includes.includes('forge') && ${{inputs.forge}};
             const includeNeoForge = includes.includes('neoforge') && ${{inputs.neoforge}};
@@ -73,8 +73,8 @@ jobs:
           script: |
             const fs = require('fs');
             const settingsGradle = fs.readFileSync('settings.gradle', 'utf8');
-            const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*["']([^"']+)["']\s*\)/gm;
-            const includes = [...settingsGradle.matchAll(includePattern)].map(match => match[1]);
+            const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*(['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])*\s*)\)/gm;
+            const includes = [...settingsGradle.matchAll(includePattern)].flatMap(match => match[0].match(/['"]([^'"]+)['"]/g).map(item => item.replace(/['"]/g, '')));
             const includeFabric = includes.includes('fabric') && ${{inputs.fabric}};
             const includeForge = includes.includes('forge') && ${{inputs.forge}};
             const includeNeoForge = includes.includes('neoforge') && ${{inputs.neoforge}};