From 95448189690e2d06a799e38d18f7041efe8641c8 Mon Sep 17 00:00:00 2001 From: Umair Date: Thu, 12 Dec 2024 14:36:39 +0000 Subject: [PATCH] Introduces a way to navigate to a particular page when viewing a deployment --- action.yml | 5 +++++ src/index.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 4593d68..94a8dc4 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,11 @@ inputs: If not supplied or supplied as an empty string then the artifacts are uploaded to S3 at root for this deployment context. required: false default: '' + landingPagePath: + description: | + The extension applied to the baseURL to aid in navigating to the correct page. e.g. if this value is "/documentation/home", then opening a deployment will navigate to this page. + required: false + default: '' mode: description: | Specify `"preempt"` in order use this action before content build in order to output the URL base. diff --git a/src/index.ts b/src/index.ts index f219262..adf0b2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,6 +61,11 @@ const sourcePath = path.resolve(core.getInput('sourcePath', {required: true})); // - Empty string indicates no value, i.e. artifact name not specified const artifactName = core.getInput('artifactName'); +// Optional landingPagePath: +// - The getInput() method calls trim() for us by default (trimWhitespace: true) +// - Empty string indicates no value, i.e. landingPagePath not specified +const landingPagePath = core.getInput('landingPagePath'); + let githubDeploymentRef: string; let s3KeyPrefix = `builds/${context.repo.owner}/${context.repo.repo}/`; let githubEnvironmentName = 'staging/'; @@ -132,9 +137,9 @@ const setDeploymentStatus = async (id: number, state: 'in_progress' | 'success' ...context.repo, deployment_id: id, state, - log_url: url, - target_url: url, - environment_url: url, + log_url: url + landingPagePath, + target_url: url + landingPagePath, + environment_url: url + landingPagePath, mediaType: { // 'flash' is needed to use the 'in_progress' state // 'ant-man' is needed to use the log_url property