-
Notifications
You must be signed in to change notification settings - Fork 57
91 lines (76 loc) · 2.36 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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/checkout@v4.2.2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install node modules
run: npm install
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3.0.0
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/wait-for-netlify-action@v2.1.1
id: preview
with:
site_name: "toha-guides"
max_timeout: 300
env:
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}}
- name: Run Lighthouse
uses: foo-software/lighthouse-check-action@v12.0.1
id: lighthouseCheck
with:
accessToken: ${{ secrets.LIGHTHOUSE_TOKEN }}
gitHubAccessToken: ${{secrets.GITHUB_TOKEN}}
emulatedFormFactor: 'all'
prCommentEnabled: true
prCommentSaveOld: false
timeout: 5
urls: "${{ steps.preview.outputs.url }},${{ steps.preview.outputs.url }}/posts/,${{ steps.preview.outputs.url }}/posts/features/,${{ steps.preview.outputs.url }}/posts/quickstart/"
# 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/wait-for-netlify-action@v2.1.1
id: preview
with:
site_name: "toha-guides"
max_timeout: 300
env:
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}}
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2.1.0
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