Skip to content

Commit 5aefff3

Browse files
authored
Add CI check for broken mattermost.com links in webapp (mattermost#35093)
* Add CI check for broken mattermost.com links in webapp Add a script that scans the webapp source files for links to mattermost.com domains and tests each unique URL for 404s. This helps detect broken documentation and marketing links early. - New script: webapp/scripts/check-external-links.mjs - New npm target: check-external-links - New CI job in webapp-ci.yml to run on every commit * Add --markdown flag for GitHub Actions job summary * Fix job summary: use pipefail and suppress progress output * Require mattermost.com links to use /pl/ permalink format * Require all mattermost.com links (including subdomains) to use /pl/ * Allow exceptions for push servers and root domain * Make non-permalink URLs warnings instead of errors * Add User-Agent header and retry GET on 403 * Follow redirects when checking URLs Check the final destination of redirects to catch broken links that redirect to error pages. If a redirect response has the Cloudflare cf-mitigated header, assume the URL is OK and stop following. * Simplify link checker code - Combine PUSH_SERVER_PATTERN and HPNS_PATTERN into single regex - Simplify validatePermalink to return boolean (reason was unused) - Consolidate Cloudflare header checks in processResponse * replace broken links with valid ones * updates
1 parent baf2bcb commit 5aefff3

7 files changed

Lines changed: 428 additions & 6 deletions

File tree

.github/workflows/webapp-ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ jobs:
4545
run: |
4646
npm run i18n-extract:check
4747
48+
check-external-links:
49+
needs: check-lint
50+
runs-on: ubuntu-24.04
51+
timeout-minutes: 15
52+
defaults:
53+
run:
54+
working-directory: webapp
55+
steps:
56+
- name: ci/checkout-repo
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
58+
- name: ci/setup
59+
uses: ./.github/actions/webapp-setup
60+
- name: ci/check-external-links
61+
run: |
62+
set -o pipefail
63+
npm run check-external-links -- --markdown | tee -a $GITHUB_STEP_SUMMARY
64+
4865
check-types:
4966
needs: check-lint
5067
runs-on: ubuntu-24.04

webapp/channels/src/components/admin_console/admin_definition.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3261,7 +3261,7 @@ const AdminDefinition: AdminDefinitionType = {
32613261
featureName: 'burn_on_read',
32623262
title: defineMessage({id: 'admin.burn_on_read_feature_discovery.title', defaultMessage: 'Send burn-on-read messages that are automatically deleted after being read'}),
32633263
description: defineMessage({id: 'admin.burn_on_read_feature_discovery.description', defaultMessage: 'With Mattermost Enterprise Advanced, users can send transient messages that are automatically deleted a fixed time after they are read by a recipient.'}),
3264-
learnMoreURL: 'https://docs.mattermost.com/deployment/burn-on-read-messages.html',
3264+
learnMoreURL: 'https://docs.mattermost.com/end-user-guide/collaborate/send-messages.html#send-burn-on-read-messages',
32653265
svgImage: BurnOnReadSVG,
32663266
},
32673267
},

webapp/channels/src/components/admin_console/feature_discovery/features/attribute_based_access_control.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const AttributeBasedAccessControlFeatureDiscovery: React.FC = () => {
2323
id: 'admin.attribute_based_access_control_feature_discovery.desc',
2424
defaultMessage: 'Create policies containing access rules based on user attributes and apply them to channels and other resources within Mattermost.',
2525
})}
26-
learnMoreURL='https://docs.mattermost.com/deployment/'
26+
learnMoreURL='https://docs.mattermost.com/administration-guide/manage/admin/attribute-based-access-control.html'
2727
featureDiscoveryImage={
2828
<SystemRolesSVG
2929
width={294}

webapp/channels/src/components/help/commands.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const HelpCommands = (): JSX.Element => {
5252
values={{
5353
link: (chunks: React.ReactNode) => (
5454
<ExternalLink
55-
href='https://docs.mattermost.com/integrations/slash-commands-built-in.html'
55+
href='https://docs.mattermost.com/integrations-guide/built-in-slash-commands.html'
5656
location='help_commands'
5757
>
5858
{chunks}

webapp/channels/src/utils/constants.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ export const AboutLinks = {
10261026
};
10271027

10281028
export const CloudLinks = {
1029-
BILLING_DOCS: 'https://docs.mattermost.com/pl/cloud-billing',
1029+
BILLING_DOCS: 'https://docs.mattermost.com/product-overview/cloud-subscriptions.html',
10301030
PRICING: 'https://mattermost.com/pl/pricing/',
10311031
PRORATED_PAYMENT: 'https://mattermost.com/pl/mattermost-cloud-prorate-documentation',
10321032
DEPLOYMENT_OPTIONS: 'https://mattermost.com/deploy/',
@@ -1074,7 +1074,7 @@ export const DocLinks = {
10741074
SETUP_LDAP: 'https://mattermost.com/pl/setup-ldap',
10751075
SETUP_PERFORMANCE_MONITORING: 'https://mattermost.com/pl/setup-performance-monitoring',
10761076
SETUP_PUSH_NOTIFICATIONS: 'https://mattermost.com/pl/setup-push-notifications',
1077-
SETUP_SAML: 'https://docs.mattermost.com/pl/setup-saml',
1077+
SETUP_SAML: 'https://docs.mattermost.com/administration-guide/onboard/sso-saml.html',
10781078
SHARE_LINKS_TO_MESSAGES: 'https://mattermost.com/pl/share-links-to-messages',
10791079
SITE_URL: 'https://mattermost.com/pl/configure-site-url',
10801080
SSL_CERTIFICATE: 'https://mattermost.com/pl/setup-ssl-client-certificate',

webapp/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"i18n-extract": "npm run i18n-extract --workspaces --if-present",
2020
"i18n-extract:check": "npm run i18n-extract:check --workspaces --if-present",
2121
"clean": "npm run clean --workspaces --if-present && rm -rf node_modules .parcel-cache",
22-
"gen-lang-imports": "node scripts/gen_lang_imports.mjs"
22+
"gen-lang-imports": "node scripts/gen_lang_imports.mjs",
23+
"check-external-links": "node scripts/check-external-links.mjs"
2324
},
2425
"dependencies": {
2526
"@mattermost/compass-icons": "0.1.53",

0 commit comments

Comments
 (0)