Only check external links once a month

This commit is contained in:
Ed Rivas 2023-06-16 00:00:55 +00:00
parent 6a05ceebee
commit 42a5e34b0f
3 changed files with 33 additions and 8 deletions

26
.github/workflows/check-links.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Check Links
on:
workflow_dispatch: # Allow running on-demand
schedule:
# 1st of every month at 8:00 UTC (4:00 Eastern)
- cron: '0 8 1 * *'
jobs:
check:
name: Check Links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build site
run: yarn build-prod
- name: Check for broken internal links
run: yarn checklinks:internal
- name: Check for broken external links
run: yarn checklinks:external

View File

@ -10,8 +10,8 @@ concurrency:
cancel-in-progress: true
jobs:
check-links:
name: Check links
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -19,13 +19,12 @@ jobs:
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Check links
- name: Install & build
run: |
yarn install --immutable
yarn build-prod
yarn checklinks:internal
yarn checklinks:external
- name: Check links
run: yarn checklinks:internal
lint:
name: Lint

View File

@ -38,7 +38,7 @@
"lint:ci": "run-s prettier:ci gts:ci stylelint:ci tsc",
"test": "echo \"Error: no test specified\" && exit 1",
"checklinks:internal": "npx --yes --package=hyperlink --package=tap-spot -- 'hyperlink --canonicalroot https://sass-lang.com/ --root _site/ -r -p -i --skip \".css.map\" --skip \".js.map\" --skip \"feed.atom\" --skip \"/documentation/js-api/\" --skip \"/blog/\" _site/index.html | tap-spot'",
"checklinks:external": "npx --yes --package=broken-link-checker -- 'blc -ro --exclude=localhost:8080 https://sass-lang.com'"
"checklinks:external": "npx --yes --package=broken-link-checker -- 'blc -ro --exclude=localhost:8080 --exclude=codepen.io --exclude=linkedin.com --exclude=docs.github.com --exclude=twitter.com https://sass-lang.com'"
},
"devDependencies": {
"@11ty/eleventy": "^2.0.1",