Update hugo.yaml #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Workflows | |
# Run action on pull request event | |
on: [pull_request] | |
jobs: | |
# Build exampleSite | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# checkout to the commit that has been pushed | |
- uses: actions/[email protected] | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install node modules | |
run: npm install | |
- name: Setup Hugo | |
uses: peaceiris/[email protected] | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Build | |
run: | | |
hugo --minify | |
lighthouse-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Waiting for Netlify Preview | |
uses: kamranayub/[email protected] | |
id: preview | |
with: | |
site_name: "toha" | |
max_timeout: 300 | |
env: | |
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}} | |
- name: Run Lighthouse | |
uses: foo-software/[email protected] | |
id: lighthouseCheck | |
with: | |
accessToken: ${{ secrets.LIGHTHOUSE_TOKEN }} | |
gitHubAccessToken: ${{secrets.GITHUB_TOKEN}} | |
emulatedFormFactor: 'all' | |
prCommentEnabled: true | |
prCommentSaveOld: true | |
timeout: 5 | |
urls: "${{ steps.preview.outputs.url }},${{ steps.preview.outputs.url }}/posts/,${{ steps.preview.outputs.url }}/posts/markdown-sample/,${{ steps.preview.outputs.url }}/posts/shortcodes/" | |
# Check for any broken links | |
markdown-link-check: | |
runs-on: ubuntu-latest | |
steps: | |
# checkout to latest commit | |
- uses: actions/checkout@master | |
- name: Waiting for Netlify Preview | |
uses: kamranayub/[email protected] | |
id: preview | |
with: | |
site_name: "toha" | |
max_timeout: 300 | |
env: | |
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}} | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/[email protected] | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
args: "--verbose --exclude-mail ${{steps.preview.outputs.url}} --exclude=['https://www.udemy.com/']" | |
output: lychee/out.md | |
- name: Comment Broken Links | |
if: ${{ steps.lychee.outputs.exit_code != 0 }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
path: lychee/out.md | |
- name: Fail workflow if broken links found | |
if: ${{ steps.lychee.outputs.exit_code != 0 }} | |
run: exit 1 |