From 14199cff13cb1563972b6e4990fdde35dcb64032 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Mon, 17 May 2021 23:43:52 +0900 Subject: [PATCH] Add pull_request event - Add pull_request event - Add filter to deploy with a default branch only --- content/en/hosting-and-deployment/hosting-on-github.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/en/hosting-and-deployment/hosting-on-github.md b/content/en/hosting-and-deployment/hosting-on-github.md index 4cb4d5e84..443bd4d01 100644 --- a/content/en/hosting-and-deployment/hosting-on-github.md +++ b/content/en/hosting-and-deployment/hosting-on-github.md @@ -47,7 +47,7 @@ This is a much simpler setup as your Hugo files and generated content are publis GitHub executes your software development workflows. Everytime you push your code on the Github repository, Github Actions will build the site automatically. -Create a file in `.github/workflows/gh-pages.yml` containing the following content (based on https://github.com/marketplace/actions/hugo-setup ): +Create a file in `.github/workflows/gh-pages.yml` containing the following content (based on [actions-hugo](https://github.com/marketplace/actions/hugo-setup)): ```yml name: github pages @@ -56,6 +56,7 @@ on: push: branches: - main # Set a branch to deploy + pull_request: jobs: deploy: @@ -77,12 +78,13 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` -For more advanced settings https://github.com/marketplace/actions/hugo-setup +For more advanced settings [actions-hugo](https://github.com/marketplace/actions/hugo-setup) and [actions-gh-pages](https://github.com/marketplace/actions/github-pages-action). ## Use a Custom Domain