The only Github Action that will open pull request review when a broken link has been found in one of your markdown documentation.
A part of a good developer experience is to ensure that the documentation is accurate. Since most of the repositories depend on different website to get additional detail. This Github action will support you to validate all the links includes in your documentation.
Apply the world in class link checker for your documentation
If you want to use the script on github action:
- Create a new file in your repository :
.github/workflows/markdown-lint.yml
- Copy paste the informations in your
.github/workflows/markdown-lint.yml
:
name: Markdown lint
on:
push:
branches: [ master ]
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:
check-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'restqa-404-links'
uses: restqa/404-links@3.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
In order to customize the linter, you will need to create a .404-links.yml
configuration file at the root level of your project.
Then you can add the following options into the file:
folder: docs/ # The folder that required to be parsed
httpsOnly: true # If you want enforce only HTTPS links
pullRequestReview: true # If you want a nice review in your pull requests
ignore:
urls: # Array of url to ignore
- https://github.com
- https://broken/* # wildcard allows
files: # Array of markdown file the shouldn't parse
- ./test.md # Relative path from the folder shared above
delay:
'https://gitlab.com': 500 # Perform a pause of 500ms at each call matching the url
property | required | type. | description | Default |
---|---|---|---|---|
folder | No | string | The folder that need to be parsed by the github action | . |
httpsOnly | No | boolean | Define all the links SHOULD be HTTPS | false |
pullRequestReview | No | boolean | Activate the pull request review creation when error are found | true |
ignore.urls | No | array | List of url to ignore | |
ignore.files | No | array | List of file to ignore during the scanning | |
delay. | No | object | Delay to apply on a domain to avoid rate limits |
In order to run the code locally you can
- Install the dependencies:
npm i
- Run the test
npm test
- @olivierodo - 🇫🇷
- test automation
- Gherkin
- Cucumber
- End to End
- E2E
- Quality assurance
- QA
- Continuous integration
- RestQa