Skip to content

Commit b399a37

Browse files
committed
GitHub Action: Check local Markdown links on push (#2067)
Adds an GitHub Action to check all local (non http://, https:// ) links in all Markdown files of the repository for liveness. Fails if a file is not found. # Goal This should help maintaining the quality of the documentation. # Impact Takes ~24 seconds currently and found 3 dead links (pull requests already created). # Dependent PRs * #2064 * #2065 * #2066 # Info See [markdown-link-check](https://github.com/marketplace/actions/markdown-link-check). # Example output ``` FILE: ./docs/profiling.md 1 links checked. FILE: ./docs/plugins_guidelines.md 37 links checked. FILE: ./docs/linters.md [✖] ../.github/linters/markdown-lint.yml → Status: 400 [Error: ENOENT: no such file or directory, access '/github/workspace/.github/linters/markdown-lint.yml'] { errno: -2, code: 'ENOENT', syscall: 'access', path: '/github/workspace/.github/linters/markdown-lint.yml' } ``` # Improvements * Can also be used to check external links, but fails because of: * Too many requests (429) responses: ``` FILE: ./CHANGELOG.md [✖] #1762 → Status: 429 ``` * crates.io links respond 404 ``` FILE: ./README.md [✖] https://crates.io/crates/bevy → Status: 404 ```
1 parent 5390be0 commit b399a37

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

.github/bors.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ status = [
77
"build-wasm (nightly, ubuntu-latest)",
88
"build-android",
99
"markdownlint",
10+
"check-markdown-links",
1011
"run-examples",
1112
"check-doc",
1213
]
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "^https?://github\\.com/"
5+
}
6+
],
7+
"replacementPatterns": [],
8+
"httpHeaders": [
9+
{
10+
"urls": ["https://crates.io"],
11+
"headers": {
12+
"Accept": "text/html"
13+
}
14+
}
15+
],
16+
"timeout": "20s",
17+
"retryOn429": true,
18+
"retryCount": 5,
19+
"fallbackRetryDelay": "30s",
20+
"aliveStatusCodes": [200, 206]
21+
}

.github/workflows/ci.yml

+10
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ jobs:
9393
# Not needed here as only one Linter is used.
9494
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9595

96+
check-markdown-links:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v2
100+
- uses: gaurav-nelson/github-action-markdown-link-check@0fe4911067fa322422f325b002d2038ba5602170
101+
with:
102+
use-quiet-mode: 'yes'
103+
use-verbose-mode: 'yes'
104+
config-file: '.github/linters/markdown-link-check.json'
105+
96106
run-examples:
97107
runs-on: ubuntu-latest
98108

docs/linters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Explanation:
2828
### [markdownlint](https://github.com/DavidAnson/markdownlint)
2929

3030
`markdownlint` is provided by `super-linter` and is responsible for `.md` files.
31-
Its configuration is saved in the [.markdown-lint.yml](../.github/linters/markdown-lint.yml) file.
31+
Its configuration is saved in the [.markdown-lint.yml](../.github/linters/.markdown-lint.yml) file.
3232

3333
The provided rules are documented [here](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md) and information about setting the config can be seen [here](https://github.com/DavidAnson/markdownlint#optionsconfig).
3434

examples/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ Please reference `cargo-apk` [README](https://crates.io/crates/cargo-apk) for ot
280280

281281
### Old phones
282282

283-
Bevy by default targets Android API level 29 in its examples which is the [Play Store's minimum API to upload or update apps](https://developer.android.com/distribute/best-practices/develop/target-sdk). Users of older phones may want to use an older API when testing.
283+
Bevy by default targets Android API level 29 in its examples which is the <!-- markdown-link-check-disable -->
284+
[Play Store's minimum API to upload or update apps](https://developer.android.com/distribute/best-practices/develop/target-sdk). <!-- markdown-link-check-enable -->
285+
Users of older phones may want to use an older API when testing.
284286

285287
To use a different API, the following fields must be updated in Cargo.toml:
286288

0 commit comments

Comments
 (0)