diff --git a/preview/README.md b/preview/README.md index 2dac74b..54a5bca 100644 --- a/preview/README.md +++ b/preview/README.md @@ -56,3 +56,4 @@ These are all the parameters this action supports: * `message-template` (_optional_): Text message to be injected by the action in the Pull Request description. It supports the following placeholders to be replaced: * `{docs-pr-index-url}`: URL to the root of the documentation for the Pull Request preview. * `platform` (_optional_): Read the Docs Community (`community`) or Read the Docs for Business (`business`). (default: `community`) +* `single_version` (_optional_): Set this to `'true'` if your project is single version, so we can link to the correct URL. (default: `false`) diff --git a/preview/action.yaml b/preview/action.yaml index 2642d8f..5fe677e 100644 --- a/preview/action.yaml +++ b/preview/action.yaml @@ -24,6 +24,10 @@ inputs: description: "Read the Docs Community or Read the Docs for Business (community or business)" default: "community" required: false + single_version: + description: "Site is a single verison project, so link to the top level." + default: 'false' + required: false runs: using: "composite" diff --git a/preview/scripts/edit-description.js b/preview/scripts/edit-description.js index 9b50287..8c035c7 100644 --- a/preview/scripts/edit-description.js +++ b/preview/scripts/edit-description.js @@ -9,7 +9,12 @@ module.exports = async ({inputs, github, context}) => { if (RTD_PLATFORM == "business") { var RTD_DOMAIN = "com.readthedocs.build"; } - var RTD_URL = `https://${RTD_PROJECT_SLUG}--${PR_NUMBER}.${RTD_DOMAIN}/${RTD_PROJECT_LANGUAGE}/${PR_NUMBER}/`; + var RTD_DOMAIN = `https://${RTD_PROJECT_SLUG}--${PR_NUMBER}.${RTD_DOMAIN}/`; + if (RTD_SINGLE_VERSION == "true") { + RTD_URL = RTD_DOMAIN + `${RTD_PROJECT_LANGUAGE}/${PR_NUMBER}/`; + } else { + RTD_URL = RTD_DOMAIN; + } var MESSAGE_SEPARATOR_START = `\r\n\r\n\r\n`; var MESSAGE_SEPARATOR_END = `\r\n`;