Skip to content

Commit 9dac5c4

Browse files
authored
Merge pull request #24 from dan-hanlon/main
Add argument for custom domain
2 parents df827f3 + d5cf094 commit 9dac5c4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ the `with` parameter.
219219

220220
Default: `pr-preview`
221221

222+
- `custom-url`: Base URL to use when providing a link to the preview site.
223+
224+
Default: Will attempt to calculate the repository's GitHub Pages URL
225+
(e.g. "rossjrw.github.io").
226+
222227
- **(Advanced)** `action`: Determines what this action will do when it is
223228
executed. Supported values: `deploy`, `remove`, `none`, `auto`.
224229

action.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ inputs:
2121
description: Directory containing files to deploy.
2222
required: false
2323
default: .
24+
custom-url:
25+
description: Custom pages URL
26+
required: false
27+
default: ""
2428
action:
2529
description: >
2630
Determines what this action will do when it is executed. Supported
@@ -55,6 +59,7 @@ runs:
5559
pr: ${{ github.event.number }}
5660
actionref: ${{ github.action_ref }}
5761
actionrepo: ${{ github.action_repository }}
62+
customurl: ${{ inputs.custom-url }}
5863
run: |
5964
echo "action=$action" >> $GITHUB_ENV
6065
echo "targetdir=$umbrella/pr-$pr" >> $GITHUB_ENV
@@ -63,7 +68,9 @@ runs:
6368
org=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 1)
6469
thirdleveldomain=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2 | cut -d "." -f 1)
6570
66-
if [ "$org" == "$thirdleveldomain" ]; then
71+
if [ ! -z "$customurl" ]; then
72+
pagesurl="$customurl"
73+
elif [ "$org" == "$thirdleveldomain" ]; then
6774
pagesurl="${org}.github.io"
6875
else
6976
pagesurl=$(echo "$GITHUB_REPOSITORY" | sed 's/\//.github.io\//')

0 commit comments

Comments
 (0)