Skip to content

Commit 49abeaf

Browse files
authored
add support for fork PRs to build preview with public theme (#58)
1 parent 78ae52b commit 49abeaf

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/preview.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
id: files
2323
uses: jitterbit/get-changed-files@v1
2424
- name: Checkout QuantEcon theme
25+
if: github.event.pull_request.head.repo.full_name == github.repository
2526
uses: actions/checkout@v2
2627
with:
2728
repository: QuantEcon/lecture-python-programming.theme
@@ -40,7 +41,7 @@ jobs:
4041
- name: Build website files
4142
shell: bash -l {0}
4243
run: |
43-
bash scripts/build-website.sh "${{ steps.files.outputs.added_modified }}"
44+
bash scripts/build-website.sh "${{ steps.files.outputs.added_modified }}" "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
4445
- name: Preview Deploy to Netlify
4546
uses: nwtgck/[email protected]
4647
if: env.BUILD_NETLIFY == 'true'

scripts/build-website.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
MODIFIED_FILES="$1"
4+
PRIVATE_THEME=$2
45

56
RST_FILES=""
67
for F in $MODIFIED_FILES
@@ -11,12 +12,17 @@ do
1112
fi
1213
done
1314
echo "List of Changed RST Files: $RST_FILES"
15+
echo "Building with Private theme: $PRIVATE_THEME"
1416
if [ -z "$RST_FILES" ]; then
1517
echo "::set-env name=BUILD_NETLIFY::false"
1618
echo "No RST Files have changed -- nothing to do in this PR"
1719
else
1820
echo "::set-env name=BUILD_NETLIFY::true"
1921
RST_FILES="$RST_FILES source/rst/index_toc.rst"
20-
make website THEMEPATH=theme/lecture-python-programming.theme FILES="$RST_FILES"
22+
if [ "$PRIVATE_THEME" = true ]; then
23+
make website THEMEPATH=theme/lecture-python-programming.theme FILES="$RST_FILES"
24+
else
25+
make website FILES="$RST_FILES"
26+
fi
2127
ls _build/website/jupyter_html/* #Ensure build files are created
2228
fi

0 commit comments

Comments
 (0)