From 1c1d0e7692f7e2e8ceda9dd9524803dd7fad2762 Mon Sep 17 00:00:00 2001 From: Pete Lumbis Date: Tue, 18 Jul 2023 12:47:17 -0400 Subject: [PATCH] Weekly scheduled external link checking (#488) --- .github/workflows/weekly-link-checker.yml | 34 +++++++++++++++++++++++ utils/htmltest/.htmltest.yml | 5 +++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/weekly-link-checker.yml diff --git a/.github/workflows/weekly-link-checker.yml b/.github/workflows/weekly-link-checker.yml new file mode 100644 index 00000000..75baff01 --- /dev/null +++ b/.github/workflows/weekly-link-checker.yml @@ -0,0 +1,34 @@ +name: Validate external links + +on: + schedule: + # “At 04:05 on Monday” + - cron: '5 4 * * 1' + + # Allows manual workflow run (must in default branch to work) + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout the docs repo + uses: actions/checkout@v3 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.109.0' + extended: true + + - name: Build + # Set to env=dev so SCSS isn't required. + run: hugo --environment development + + - name: Enable external link checking + run: "sed -i 's/CheckExternal: false/CheckExternal: true/' utils/htmltest/.htmltest.yml" + + - name: Run htmltest + uses: wjdp/htmltest-action@master + with: + config: ./utils/htmltest/.htmltest.yml diff --git a/utils/htmltest/.htmltest.yml b/utils/htmltest/.htmltest.yml index 0732e868..99997423 100644 --- a/utils/htmltest/.htmltest.yml +++ b/utils/htmltest/.htmltest.yml @@ -4,4 +4,7 @@ DirectoryPath: "public" IgnoreInternalEmptyHash: true CheckExternal: false IgnoreURLs: - - "github.com/crossplane/docs/tree/master/content/(.*).md" # Ignore the links to "view this source" \ No newline at end of file + - "github.com/crossplane/docs/tree/master/content/(.*).md" # Ignore the links to "view this source" + - "www.googletagmanager.com/*" # Ignore google tag manager + - "twitter.com/*" # Ignore twitter links since they send to login page +