From 6b575363918c79fc72b73f71953e69cf101a9a2a Mon Sep 17 00:00:00 2001
From: Sujay Patil <sujaysanjeev.patil@gmail.com>
Date: Wed, 12 Jun 2024 12:22:00 -0700
Subject: [PATCH 1/2] GitHub Action workflow to preview documentation changes
 in PRs

---
 .../.github/workflows/deploy-docs.yaml        |  2 +-
 .../.github/workflows/test_pages_build.yaml   | 44 +++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 {{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml

diff --git a/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml b/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml
index 9780a9c..784dca6 100644
--- a/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml
+++ b/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml
@@ -16,7 +16,7 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
         with:
           fetch-depth: 0  # otherwise, you will failed to push refs to dest repo
 
diff --git a/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml b/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml
new file mode 100644
index 0000000..b1c9045
--- /dev/null
+++ b/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml
@@ -0,0 +1,44 @@
+name: Preview cookiecutter.__project_slug}} documentation build
+
+on:
+  pull_request:
+    types:
+      - opened
+      - reopened
+      - synchronize
+
+concurrency: preview-${{ github.ref }}
+
+jobs:
+  run:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Set up Python 3
+        uses: actions/setup-python@v4
+        with:
+          python-version: 3.9
+
+      - name: Install Poetry
+        run: pipx install poetry
+
+      - name: Install dependencies
+        run: poetry install -E docs
+
+      - name: Build documentation
+        run: |
+          mkdir -p site
+          touch site/.nojekyll
+          make gendoc
+          ([ ! -f docs/about.md ] && cp src/docs/about.md docs/) || true
+          poetry run mkdocs build -d site
+
+      - name: Deploy preview
+        uses: rossjrw/pr-preview-action@v1
+        with:
+          source-dir: site/
+          preview-branch: gh-pages

From a0dc2221a6116e73c634bea614ef3007c167cf7a Mon Sep 17 00:00:00 2001
From: Sujay Patil <sujaysanjeev.patil@gmail.com>
Date: Mon, 17 Jun 2024 16:06:30 -0700
Subject: [PATCH 2/2] fix typo in test_pages_build.yaml Action workflow name

---
 .../.github/workflows/test_pages_build.yaml                     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml b/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml
index b1c9045..3e7b5f8 100644
--- a/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml
+++ b/{{cookiecutter.project_name}}/.github/workflows/test_pages_build.yaml
@@ -1,4 +1,4 @@
-name: Preview cookiecutter.__project_slug}} documentation build
+name: Preview {{cookiecutter.__project_slug}} documentation build
 
 on:
   pull_request: