improve installation match; refactor test per copilot review

This commit is contained in:
Stefan Petrushevski
2025-07-08 17:52:25 +02:00
parent 3c69395e16
commit 46f9f788b8
3 changed files with 8 additions and 9 deletions
+2 -3
View File
@@ -42667,12 +42667,11 @@ async function getTokenFromEnterprise(request2, auth5, enterprise2, permissions2
}
});
const enterpriseInstallation = response.data.find(
(installation) => installation.target_type === "Enterprise"
(installation) => installation.target_type === "Enterprise" && installation.account?.slug === enterprise2
);
if (!enterpriseInstallation) {
throw new Error(`No enterprise installation found. Available installations: ${response.data.map((i) => `${i.target_type}:${i.account?.login || "N/A"}`).join(", ")}`);
throw new Error(`No enterprise installation found matching the name ${enterprise2}. Available installations: ${response.data.map((i) => `${i.target_type}:${i.account?.login || "N/A"}`).join(", ")}`);
}
console.info(`### Found enterprise installation: ${JSON.stringify(enterpriseInstallation, null, 2)}`);
const authentication = await auth5({
type: "installation",
installationId: enterpriseInstallation.id,