From ac5eaa10f604e27ed1d00a239e6b8c7bd8a7cadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20M=C3=BCller?= Date: Fri, 25 Jun 2021 08:38:01 +0200 Subject: [PATCH] Use the project domain as site-url not the siteUrl of the webspace for the production branch --- index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 327a59f..3a8ae30 100644 --- a/index.js +++ b/index.js @@ -646,9 +646,25 @@ try { } function retrieveProjectInfo(counter) { - instance.get(`/v1/projects/${project}/branches`, { params: { name: branchName } }) + instance.get(`/v1/projects/${project}`) .then(res => { - const branches = res.data.values.filter(branch => branch.name === branchName); + const project = res.data; + if (project.productionBranch.name === branchName) { + const branch = project.productionBranch; + console.log(`site-url: https://${project.domain}`) + core.setOutput("site-url", `https://${project.domain}`); + console.log(`remote-host: ${branch.webSpace.sshHost}`) + core.setOutput("remote-host", branch.webSpace.sshHost); + console.log(`branch-id: ${branch.id}`) + core.setOutput("branch-id", branch.id); + console.log(`storage-quota: ${branch.webSpaceQuota.storageQuota}`) + core.setOutput("storage-quota", branch.webSpaceQuota.storageQuota); + console.log(`deployment-enabled: true`) + core.setOutput("deployment-enabled", true); + return; + } + + const branches = project.branches.filter(branch => branch.name === branchName); if (branches.length === 0) { if (counter === 0) { core.setFailed(`Branch ${branchName} not found in IONOS.space`);