From 960b8a55040cfaf14580bc5b1cff0ac1adbaf169 Mon Sep 17 00:00:00 2001 From: Tzvi Melamed Date: Fri, 10 Nov 2023 13:04:27 -0500 Subject: [PATCH] Add action outputs for site id and url --- action.yml | 5 +++++ src/action.ts | 2 +- src/main.ts | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7057f8d..5288fa7 100644 --- a/action.yml +++ b/action.yml @@ -27,6 +27,11 @@ inputs: clone-certificate: description: Forge SSL certificate ID to clone to the preview site. required: false +outputs: + site-url: + description: 'The URL of the site that was deployed.' + site-id: + description: 'The Forge ID of the site that was created.' runs: using: node20 main: dist/index.js diff --git a/src/action.ts b/src/action.ts index c0d0af5..f5f9552 100644 --- a/src/action.ts +++ b/src/action.ts @@ -87,7 +87,7 @@ export async function createPreview({ core.info('Waiting for SSL certificate to be activated.'); await site.ensureCertificateActivated(); - return { url: `https://${site.name}` }; + return { url: `https://${site.name}`, id: site.id }; } export async function destroyPreview({ diff --git a/src/main.ts b/src/main.ts index bf915ce..9581b5c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -94,6 +94,9 @@ export async function run() { }); if (preview) { + core.setOutput('site-url', preview.url); + core.setOutput('site-id', preview.id); + const octokit = github.getOctokit(githubToken); octokit.rest.issues.createComment({ owner: pr.repository.owner.login,