From 06f9fa101c83b1ccbbbeffe38d0eba6cd979f916 Mon Sep 17 00:00:00 2001 From: Robert Sese Date: Fri, 29 Oct 2021 15:50:22 -0500 Subject: [PATCH] Add GHEC link check workflow (#22478) * Add GHEC link checker workflow * Update link check script for GHEC * Remove stale comments --- .github/workflows/link-check-ghec.yml | 36 +++++++++++++++++++++++++++ script/check-internal-links.js | 9 +++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/link-check-ghec.yml diff --git a/.github/workflows/link-check-ghec.yml b/.github/workflows/link-check-ghec.yml new file mode 100644 index 0000000000..58e0c20e1d --- /dev/null +++ b/.github/workflows/link-check-ghec.yml @@ -0,0 +1,36 @@ +name: 'Link Checker: Enterprise Cloud' + +# **What it does**: This checks links for GHEC version of docs. +# **Why we have it**: We want to know if links break. +# **Who does it impact**: Docs content. + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }} + steps: + - name: Checkout + uses: actions/checkout@1e204e9a9253d643386038d443f96446fa156a97 + + - name: Setup node + uses: actions/setup-node@270253e841af726300e85d718a5f606959b2903c + with: + node-version: 16.8.x + cache: npm + + - name: Install + run: npm ci + + - name: Build + run: npm run build + + - name: 'Link check: Enterprise Cloud' + env: + DOCS_VERSION: 'enterprise-cloud' + run: npm run link-check diff --git a/script/check-internal-links.js b/script/check-internal-links.js index 19de6d38ef..5bbe542541 100755 --- a/script/check-internal-links.js +++ b/script/check-internal-links.js @@ -16,7 +16,7 @@ import { deprecated, latest } from '../lib/enterprise-server-releases.js' const checker = new linkinator.LinkChecker() const englishRoot = 'http://localhost:4002/en' -const allowedVersions = ['dotcom', 'enterprise-server', 'github-ae'] +const allowedVersions = ['dotcom', 'enterprise-cloud', 'enterprise-server', 'github-ae'] const config = { path: englishRoot, @@ -40,12 +40,17 @@ const config = { // Customize config for specific versions if (process.env.DOCS_VERSION === 'dotcom') { - // If Dotcom, skip Enterprise Server and GitHub AE links + // If Dotcom, skip Enterprise Cloud, Enterprise Server, and GitHub AE links config.linksToSkip.push( + '^.*/enterprise-cloud@latest.*$', '^.*/enterprise-server@.*$', '^.*/enterprise/.*$', '^.*/github-ae@latest.*$' ) +} else if (process.env.DOCS_VERSION === 'enterprise-cloud') { + // If Enterprise Cloud, skip links that are not Enterprise Cloud links + config.path = `${englishRoot}/enterprise-cloud@latest` + config.linksToSkip.push('^((?!enterprise-cloud@latest).)*$') } else if (process.env.DOCS_VERSION === 'enterprise-server') { // If Enterprise Server, skip links that are not Enterprise Server links config.path = `${englishRoot}/enterprise-server@${latest}`