Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add single-language #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ 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'`)
* `single-version` (_optional_): Set this to `'true'` if your project is single version, so we can link to the correct URL. (`/`) (default: `'false'`)
* `single-language` (_optional_): Set this to `'true'` if your project is multi-version but single language, so we can link to the correct URL. (`/$version/`) (default: `'false'`)
3 changes: 3 additions & 0 deletions preview/scripts/edit-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = async ({inputs, github, context}) => {
const RTD_PROJECT_LANGUAGE = inputs["project-language"];
const RTD_PLATFORM = inputs["platform"];
const RTD_SINGLE_VERSION = inputs["single-version"];
const RTD_SINGLE_LANGUAGE = inputs["single-language"];

let RTD_DOMAIN = "";
let RTD_URL = "";
Expand All @@ -19,6 +20,8 @@ module.exports = async ({inputs, github, context}) => {

if (RTD_SINGLE_VERSION === "true") {
RTD_URL = RTD_PROJECT_DOMAIN;
} else if (RTD_SINGLE_LANGUAGE) {
RTD_URL = RTD_PROJECT_DOMAIN + `${RTD_SINGLE_LANGUAGE}/`;
} else {
RTD_URL = RTD_PROJECT_DOMAIN + `${RTD_PROJECT_LANGUAGE}/${PR_NUMBER}/`;
}
Expand Down