forked from aws-amplify/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.44 KB
/
check_pr_for_broken_links.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
name: CheckPRLinks
on:
pull_request:
branches: [main, next-release/main]
types: [opened, synchronize]
env:
BUILD_DIR: 'client/www/next-build'
jobs:
CheckPRLinks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 https://github.com/actions/checkout/commit/f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup Node.js 20
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 https://github.com/actions/setup-node/commit/e33196f7422957bea03ed53f6fbb155025ffc7b8
with:
node-version: 20.x
- name: Install Dependencies
run: yarn
- name: Run Build
run: yarn build
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Run Server
run: |
python -m http.server 3000 -d ${{ env.BUILD_DIR }} &
sleep 5
- name: Run Link Checker
id: checkLinks
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
result-encoding: string
script: |
const { checkDevLinks } = require('./tasks/link-checker.js');
return await checkDevLinks();
- name: Fail if broken links have been found
if: ${{ steps.checkLinks.outputs.result }}
run: exit 1