Skip to content

Commit

Permalink
Feature: Add base path (#16)
Browse files Browse the repository at this point in the history
* Add base path to test which defaults to /

* Add base_path to readme
  • Loading branch information
jawakarD authored Nov 9, 2021
1 parent d85a22d commit 7ccf91c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit 7ccf91c

Please sign in to comment.