Skip to content

Commit

Permalink
Add external URL health checks in CI/CD
Browse files Browse the repository at this point in the history
This commit adds automated checks for dead external URLs in the
documentation during CI/CD pipeline. It configures
`remark-lint-no-dead-urls` plugin with custom ignore patterns to handle
false positives.
This commit adds URL aliveness checks in CI/CD that was previously
missing, adding ignore rules for false negatives.

Changes:

- Add missing external URL checking in GitHub workflow.
- Add ignore patterns for false negatives.
- Remove fail fast feature from quality checks to receive results from
  all commands.
  • Loading branch information
undergroundwires committed Jan 26, 2025
1 parent e8af173 commit f361b3a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/quality-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
- lint:css
- lint:md
- lint:md:urls:relative
- lint:md:urls:external
- lint:md:consistency
fail-fast: false # Still interested to see results from other commands
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
19 changes: 19 additions & 0 deletions .remark-lint-no-dead-urls.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import remarkLintNoDeadUrls from 'remark-lint-no-dead-urls';

/** @type {import('remark-lint-no-dead-urls').Options} */
const Options = {
skipUrlPatterns: [
// These return 403 (Forbidden) to checks
'codepen.io', // 'https://codepen.io'
].map(buildUrlPattern),
};

/** @type {Omit<import('unified-engine').Preset} */
export default {
plugins: [[remarkLintNoDeadUrls, Options]],
};

function buildUrlPattern(fqdn) {
const escaped = fqdn.replace(/\./g, '\\.');
return `^https://${escaped}/.*$`;
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ You can choose one of the following existing themes to begin:

##### Custom Themes

Or you can create your own theme & import it. Check example themes at [existing themes](./src/themes/). [The HTML](./src/ez-consent.js#L18) uses only a few classes using [BEM](http://getbem.com/naming/) naming convention.
Or you can create your own theme & import it. Check example themes at [existing themes](./src/themes/). [The HTML](./src/ez-consent.js#L18) uses only a few classes using [BEM](https://getbem.com/naming/) naming convention.

You can also add your own class names using `css_classes` option, see [initialization](#2-initialize) for details.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint:css": "stylelint \"**/*.css\"",
"lint:md": "markdownlint **/*.md --ignore node_modules",
"lint:md:urls:relative": "remark . --frail --use remark-validate-links",
"lint:md:urls:external": "remark . --frail --use remark-lint-no-dead-urls",
"lint:md:urls:external": "remark . --frail --rc-path .remark-lint-no-dead-urls.mjs",
"lint:md:consistency": "remark . --frail --use remark-preset-lint-consistent"
},
"repository": {
Expand Down

0 comments on commit f361b3a

Please sign in to comment.