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

Feature: Add base path #16

Merged
merged 2 commits into from
Nov 9, 2021
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Optional — Stringified HTTP Header object key/value pairs to send in requests

Optional — The amount of time to spend waiting on Netlify. Defaults to `60` seconds

### `base_path`

Optional — The page that needs to be tested for 200. Defaults to "/" (eg: `https://{site_name}.netlify.app{base_path}`)

## Outputs

### `url`
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
max_timeout:
description: "The max time to run the action"
required: false
base_path:
description: "Base path to test"
required: false
default: "/"
outputs:
url:
description: "The fully qualified deploy preview URL"
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ const run = async () => {
}
const MAX_TIMEOUT = Number(core.getInput("max_timeout")) || 60;
const siteName = core.getInput("site_name");
const basePath = core.getInput("base_path");
if (!siteName) {
core.setFailed("Required field `site_name` was not provided");
}
const url = `https://deploy-preview-${PR_NUMBER}--${siteName}.netlify.app`;
const url = `https://deploy-preview-${PR_NUMBER}--${siteName}.netlify.app${basePath}`;
core.setOutput("url", url);
const extraHeaders = core.getInput("request_headers");
const headers = !extraHeaders ? {} : JSON.parse(extraHeaders)
Expand Down