From 42a5e34b0febef9b9b9e22c831be174a50ff1ae4 Mon Sep 17 00:00:00 2001 From: Ed Rivas Date: Fri, 16 Jun 2023 00:00:55 +0000 Subject: [PATCH] Only check external links once a month --- .github/workflows/check-links.yml | 26 ++++++++++++++++++++++++++ .github/workflows/test.yml | 13 ++++++------- package.json | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/check-links.yml diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 0000000..e3ad428 --- /dev/null +++ b/.github/workflows/check-links.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c760048..c4f053b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/package.json b/package.json index 724a395..0b225a2 100644 --- a/package.json +++ b/package.json @@ -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",