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