Skip to content

Commit

Permalink
Fix false negatives for CI/CD external URL checks
Browse files Browse the repository at this point in the history
This commit fixes failing CI/CD worklows due to false positive URL
checks by adding ignore rules to the checks. It also resolves a dead URL
by using its archived version for its current URL.

Changes:

- Use separate config file to configure dead URL checks
- Add FQDN-based ignore rules
- Fix a dead URL by using its new URL in archived version
  • Loading branch information
undergroundwires committed Jan 26, 2025
1 parent e11821f commit 451ca76
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- npm run lint:md:relative-urls
- npm run lint:md:external-urls
os: [ macos, ubuntu, windows ]
fail-fast: false # Still interested to see results from other combinations
fail-fast: false # Still interested to see results from other commands
steps:
-
name: Checkout
Expand Down
20 changes: 20 additions & 0 deletions .remark-lint-no-dead-urls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import remarkLintNoDeadUrls from 'remark-lint-no-dead-urls';

/** @type {import('remark-lint-no-dead-urls').Options} */
const Options = {
skipUrlPatterns: [
// These result in false negatives
'archive.ph',
'scoop.sh',
].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 docs/ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Convention for naming pipeline files: **`<type>.<name>.yaml`**.
- Kebab-case allows to have better URL references to them.
- [README.md](./../README.md) uses URL references to show status badges for actions.

[1]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows
[1]: https://web.archive.org/web/20250126141528/https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows "Workflow syntax for GitHub Actions - GitHub Docs | docs.github.com"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lint:md": "markdownlint **/*.md --ignore node_modules",
"lint:md:consistency": "remark . --frail --use remark-preset-lint-consistent",
"lint:md:relative-urls": "remark . --frail --use remark-validate-links",
"lint:md:external-urls": "remark . --frail --use remark-lint-no-dead-urls",
"lint:md:urls:external": "remark . --frail --rc-path .remark-lint-no-dead-urls.mjs",
"lint:yaml": "yamllint **/*.yaml --ignore=node_modules/**/*.yaml",
"lint:pylint": "pylint **/*.py",
"postinstall": "electron-builder install-app-deps",
Expand Down

0 comments on commit 451ca76

Please sign in to comment.