Skip to content
link-2

GitHub Action

404 Links

3.1.4 Latest version

404 Links

link-2

404 Links

It is a part of quality assurance to check that your markdown files doesn't contains broken links

Installation

Copy and paste the following snippet into your .yml file.

              

- name: 404 Links

uses: atalent-labs/404-links@3.1.4

Learn more about this action in atalent-labs/404-links

Choose a version

404-links - Github Action

The only Github Action that will open pull request review when a broken link has been found in one of your markdown documentation.

Table of Contents

About

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

Example

Screen Recording 2566-01-22 at 10 44 15 PM-min (1)

Summary

image

Creation of Pull Request Review

Example

Versions

Github Action

If you want to use the script on github action:

  1. Create a new file in your repository : .github/workflows/markdown-lint.yml
  2. 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 }}

Customize the linting

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

Options

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

Contribution Development

In order to run the code locally you can

  • Install the dependencies: npm i
  • Run the test npm test

Author

License

MIT License

References

Keywords

  • test automation
  • Gherkin
  • Cucumber
  • End to End
  • E2E
  • Quality assurance
  • QA
  • Continuous integration
  • RestQa

License

MIT License