Giter Site home page Giter Site logo

gaurav-nelson / github-action-markdown-link-check Goto Github PK

View Code? Open in Web Editor NEW
393.0 9.0 77.0 113 KB

Check all links in markdown files if they are alive or dead. ๐Ÿ”—โœ”๏ธ

License: MIT License

Dockerfile 3.06% Shell 96.94%
markdown-link-check link-checker link-checking markdown action scheduled-runs hacktoberfest

github-action-markdown-link-check's Introduction

๐Ÿšจ Update (November 2023)

This action uses markdown-link-check to find broken links. However, it has some limitations and issues that affect the accuracy, performance of the checking process, and the output. It also makes it hard to add new features.

I am working on a new tool similar to this action but one that reduces false positives and includes the most requested features.

I am currently working on developing and testing Linkspector, and I hope to release it soon. In the meantime, I'll support this action in maintenance-only mode as I want to focus more on Linkspector. I appreciate your understanding and patience.

If you're interested in Linkspector, follow its progress on its GitHub repository. Thank you for using this action, and I hope you will enjoy Linkspector when it is ready.

GitHub Action - Markdown link check ๐Ÿ”—โœ”๏ธ

GitHub Marketplace Donate using Liberapay

This GitHub action checks all Markdown files in your repository for broken links. (Uses tcort/markdown-link-check)

How to use

  1. Create a new file in your repository .github/workflows/action.yml.

  2. Copy-paste the following workflow in your action.yml file:

    name: Check Markdown links
    
    on: push
    
    jobs:
      markdown-link-check:
        runs-on: ubuntu-latest
        steps:
        - uses: actions/checkout@master
        - uses: gaurav-nelson/github-action-markdown-link-check@v1

Real-life usage samples

Following is a list of some of the repositories which are using GitHub Action - Markdown link check.

  1. netdata
  2. GoogleChrome/lighthouse (Weekly cron job)
  3. tendermint/tendermint
  4. pyroscope-io/pyroscope

If you are using this on production, consider buying me a coffee โ˜•.

Configuration

Custom variables

You customize the action by using the following variables:

Variable Description Default value
use-quiet-mode Specify yes to only show errors in output. no
use-verbose-mode Specify yes to show detailed HTTP status for checked links. no
config-file Specify a custom configuration file for markdown-link-check. You can use it to remove false-positives by specifying replacement patterns and ignore patterns. The filename is interpreted relative to the repository root. mlc_config.json
folder-path By default the github-action-markdown-link-check action checks for all markdown files in your repository. Use this option to limit checks to only specific folders. Use comma separated values for checking multiple folders. .
max-depth Specify how many levels deep you want to check in the directory structure. The default value is -1 which means check all levels. -1
check-modified-files-only Use this variable to only check modified markdown files instead of checking all markdown files. The action uses git to find modified markdown files. Only use this variable when you run the action to check pull requests. no
base-branch Use this variable to specify the branch to compare when finding modified markdown files. master
file-extension By default the github-action-markdown-link-check action checks files in your repository with the .md extension. Use this option to specify a different file extension such as .markdown or .mdx. .md
file-path Specify additional files (with complete path and extension) you want to check. Use comma separated values for checking multiple files. See Check multiple directories and files section for usage. -

Sample workflow with variables

name: Check Markdown links

on: push

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-quiet-mode: 'yes'
        use-verbose-mode: 'yes'
        config-file: 'mlc_config.json'
        folder-path: 'docs/markdown_files'
        max-depth: 2

Scheduled runs

In addition to checking links on every push, or pull requests, its also a good hygiene to check for broken links regularly as well. See Workflow syntax for GitHub Actions - on.schedule for more details.

Sample workflow with scheduled job

name: Check Markdown links

on:
  push:
    branches:
    - master
  schedule:
  # Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
  - cron: "0 9 * * *"

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-quiet-mode: 'yes'
        use-verbose-mode: 'yes'
        config-file: 'mlc_config.json'
        folder-path: 'docs/markdown_files'

Disable check for some links

You can include the following HTML comments into your markdown files to disable checking for certain links in a markdown document.

  1. <!-- markdown-link-check-disable --> and <!-- markdown-link-check-enable-->: Use these to disable links for all links appearing between these comments.
    • Example:
      <!-- markdown-link-check-disable -->
      ## Section
      
      Disbale link checking in this section. Ignore this [Bad Link](https://exampleexample.cox)
      <!-- markdown-link-check-enable -->
  2. <!-- markdown-link-check-disable-next-line --> Use this comment to disable link checking for the next line.
  3. <!-- markdown-link-check-disable-line --> Use this comment to disable link checking for the current line.

Check only modified files in a pull request

Use the following workflow to only check links in modified markdown files in a pull request.

When you use this variable, the action finds modified files between two commits:

  • latest commit in you PR
  • latest commit in the master branch. If you are suing a different branch to merge PRs, specify the branch using base-branch.

NOTE: We can also use GitHub API to get all modified files in a PR, but that would require tokens and stuff, create an issue or PR if you need that.

on: [pull_request]
name: Check links for modified files
jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-quiet-mode: 'yes'
        use-verbose-mode: 'yes'
        check-modified-files-only: 'yes'

Check multiple directories and files

on: [pull_request]
name: Check links for modified files
jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-quiet-mode: 'yes'
        folder-path: 'md/dir1, md/dir2'
        file-path: './README.md, ./LICENSE, ./md/file4.markdown'

Too many requests

Use retryOn429, retry-after, retryCount, and fallbackRetryDelay in your custom configuration file. See https://github.com/tcort/markdown-link-check#config-file-format for details.

Or mark 429 status code as alive:

{
  "aliveStatusCodes": [429, 200]
}

GitHub links failure fix

Use the following httpHeaders in your custom configuration file to fix GitHub links failure.

{
  "httpHeaders": [
    {
      "urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"],
      "headers": {
        "Accept-Encoding": "zstd, br, gzip, deflate"
      }
    }
  ]
}

Example Usage

Consider a workflow file that checks for the status of hyperlinks on push to the master branch,

name: Check .md links

on:
  push: [master]

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    # check out the latest version of the code
    steps:
    - uses: actions/checkout@v3

    # Checks the status of hyperlinks in .md files in verbose mode
    - name: Check links
      uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-verbose-mode: 'yes'

A file test.md exists, containing

image

On running the workflow described above, the output shown below is obtained

image

Versioning

GitHub Action - Markdown link check follows the GitHub recommended versioning strategy.

  1. To use a specific released version of the action (Releases):
    - uses: gaurav-nelson/[email protected]
  2. To use a major version of the action:
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
  3. You can also specify a specific commit SHA as an action version:
    - uses: gaurav-nelson/github-action-markdown-link-check@44a942b2f7ed0dc101d556f281e906fb79f1f478

Buy me a coffee.

github-action-markdown-link-check's People

Contributors

bflad avatar bpkroth avatar creachadair avatar danyalaytekin avatar deepsourcebot avatar edumco avatar exoego avatar gaurav-nelson avatar heidihoward avatar mgrojo avatar namyalg avatar oncleben31 avatar pandapip1 avatar patrickheneise avatar petethepig avatar qaristote avatar rajbos avatar rezarahemtola avatar ruzickap avatar sadra-barikbin avatar snyk-bot avatar thanethomson avatar tripleight avatar xanderstrike avatar xvincentx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-action-markdown-link-check's Issues

Wrong filename output

Output:

=========================> MARKDOWN LINK CHECK <=========================


FILE: docs/jpackage.md
[โœ–] https://github.com/YOUR_USERNAME/jabref โ†’ Status: 404


FILE: docs/adr/0004-use-mariadb-connector.md
[โœ–] https://github.com/JabRef/jabref/wiki/Translating-JabRef-Help โ†’ Status: 429
[โœ–] https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java โ†’ Status: 429

(Source: https://github.com/JabRef/jabref/pull/6524/checks?check_run_id=714600307)

The link with YOUR_USERNAME appears in a different file:

grafik

Same for the other block:

grafik

Is it possible to output the correct file name?

My config:

      - name: Run markdown-link-check
        uses: gaurav-nelson/github-action-markdown-link-check@v1
        with:
          use-quiet-mode: 'yes'
          use-verbose-mode: 'yes'
          config-file: 'mlc_config.json'
          folder-path: 'docs/'

Minor improvements for README.md

Hey man, great stuff, thanks for the action, I could quickly integrate with my repo https://github.com/derberg/awesome-asyncapi/blob/master/.github/workflows/main.yml

Small comments from my side:

  • default checkout depth is set to 1 so you do not have to set it explicitly
  • I think most common sense for links validation is a scheduled check because links can stop working overtime without changes in the repo so would be good to have an example with cron schedule to easy onboarding to the action

feel free to do whatever you want with my proposals, most important for me was to tell thank you

Enabling options causes false positives

I'm enabling this action on my repo in this PR JoshOrndorff/recipes#287

You can see in the last three commits that I have fixed all links so that the link checker passes (b07b54b). Then I enable to config file and CI fails reporting broken links (aca0ad6). Then I disable the config file and the CI passes again (d87a476).

Enabling quiet mode also caused false positives.

Create a v2 using GitHub Actions toolkit

Currently, the action uses the markdown-link-check CLI tool and executes a bash script. Over time the bash script has become too long to manage and test. Changes often result in breaking some or other functionality.

As we advance, I think it's best to create a v2 of this action using the GitHub Actions toolkit.

folder-path is ignored

Using the following action:

name: Check Markdown Links

on:
  pull_request:
    branches:
      - master
      - develop

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        folder-path: "./docs/"
    - uses: gaurav-nelson/github-action-markdown-link-check@master

I would expect only the docs/ folder to be checked, but it goes ahead and checks all .md files anyway:

FILE: ./.github/CODE_OF_CONDUCT.md
[โœ“] https://github.com/stoplightio/code-of-conduct/blob/master/incident-reporting.md
[โœ“] https://github.com/stoplightio/code-of-conduct/blob/master/long-form-code-of-conduct.md#long-form-code-of-conduct

2 links checked.

FILE: ./CHANGELOG.md
[โœ“] https://keepachangelog.com/en/1.0.0/
[โœ“] https://semver.org/spec/v2.0.0.html
[โœ“] https://github.com/stoplightio/spectral/issues/747
[โœ“] https://github.com/stoplightio/spectral/pull/1011
[โœ“] https://github.com/stoplightio/spectral/pull/1009
[โœ“] https://github.com/stoplightio/spectral/issues/725
[โœ“] https://github.com/stoplightio/spectral/pull/706
[โœ–] https://github.com/stoplightio/spectral/issues/585
[โœ–] https://github.com/stoplightio/spectral/pull/719
[โœ–] https://github.com/stoplightio/spectral/pull/685
[โœ–] https://github.com/stoplightio/spectral/pull/839
[โœ–] https://github.com/stoplightio/spectral/pull/867
[โœ–] https://github.com/stoplightio/spectral/pull/652
[โœ–] https://github.com/stoplightio/json-ref-resolver/pull/141
[โœ–] https://github.com/stoplightio/json-ref-resolver/pull/146
[โœ–] https://github.com/stoplightio/json-ref-resolver/pull/140
[โœ–] https://github.com/stoplightio/json-ref-resolver/pull/147
[โœ–] https://github.com/stoplightio/spectral/issues/679
[โœ–] https://github.com/stoplightio/spectral/issues/751
[โœ–] https://github.com/stoplightio/spectral/pull/846
[โœ–] https://github.com/stoplightio/spectral/pull/824
[โœ–] https://github.com/stoplightio/spectral/issues/680
[โœ–] https://github.com/stoplightio/spectral/pull/737

I am adding in some comments to turn it off and back on again in the changelog, but I'd prefer to be able to use this handy feature.

If you've got a buy me a coffee button or wanna add a Treeware button I'll be happy to throw a few in. :)

Support for modifying find -name for Markdown files with .markdown extension

Description

Hi there ๐Ÿ‘‹ This project looks great!

Our project currently uses file names with a file extension ending .markdown instead of .md. Currently, the find command is hardcoded in the entrypoint to only work with *.md:

if [ "$5" -ne -1 ]; then
FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*.md' '-not' '-path' './node_modules/*' '-maxdepth' "${MAX_DEPTH}" '-exec' 'markdown-link-check' '{}')
else
FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*.md' '-not' '-path' './node_modules/*' '-exec' 'markdown-link-check' '{}')
fi

Would you accept making the file extension or name pattern configurable?

Proposal

Introduce new parameter for the file name pattern (file-name-pattern) or file extension (file-extension) in action.yml:

  file-extension:
    description: 'Use this to specify the file extension of Markdown files.'
    required: true
    default: '.md'

runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.use-quiet-mode }}
    - ${{ inputs.use-verbose-mode }}
    - ${{ inputs.config-file }}
    - ${{ inputs.folder-path }}
    - ${{ inputs.max-depth }}
    - ${{ inputs.check-modified-files-only }}
    - ${{ inputs.base-branch }}
    - ${{ inputs.file-extension }}

And wire that new parameter into entrypoint.sh:

FILE_EXTENSION="$8"
# ...
   if [ "$5" -ne -1 ]; then
      FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*'"${FILE_EXTENSION}" '-not' '-path' './node_modules/*' '-maxdepth' "${MAX_DEPTH}" '-exec' 'markdown-link-check' '{}')
   else
      FIND_CALL=('find' "${FOLDER_PATH}" '-name' '*'"${FILE_EXTENSION}" '-not' '-path' './node_modules/*' '-exec' 'markdown-link-check' '{}')
   fi

Please let me know if you have any questions or if I can contribute. Thanks!

TypeError: Cannot read property 'get' of undefined

at ChildProcess.exithandler (child_process.js:283:5)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
TypeError: Cannot read property 'get' of undefined
at errorHandler (/usr/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
at /usr/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/usr/lib/node_modules/npm/lib/npm.js:228:22)
at /usr/lib/node_modules/npm/lib/npm.js:266:24
at /usr/lib/node_modules/npm/lib/config/core.js:83:7
at Array.forEach ()
at /usr/lib/node_modules/npm/lib/config/core.js:82:13
at f (/usr/lib/node_modules/npm/node_modules/once/once.js:25:25)
at afterExtras (/usr/lib/node_modules/npm/lib/config/core.js:173:20)
at Conf. (/usr/lib/node_modules/npm/lib/config/core.js:231:22)
/usr/lib/node_modules/npm/lib/utils/error-handler.js:205
if (npm.config.get('json')) {
^
TypeError: Cannot read property 'get' of undefined
at process.errorHandler (/usr/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
at emitOne (events.js:116:13)
at process.emit (events.js:211:7)
at process._fatalException (bootstrap_node.js:391:26)
##[error]Docker run failed with exit code 7
##[debug]Finishing: Run gaurav-nelson/[email protected]

Having trouble running link check

I've got my link check set up with some broken links in my Readme. It's not flagging them as broken. Anything I could be missing?

on: [pull_request]
name: Check markdown links
jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@master
      with:
        use-quiet-mode: 'yes'
        use-verbose-mode: 'yes'
        check-modified-files-only: 'yes'
        base-branch: 'main'

PR where the link check returned OK instead of broken links. tjperry07/vale-setup#26

Custom variable to only check new or modified markdown files in a PR

Currently, if this github action is used as a pre-check on a PR, it still goes through all files in the repository regardless of whether they were touched in the PR or not. It would be nice to have a custom variable to switch between these two modes:

  1. Only check new/modified files
  2. Check all files

Proper version tagging

Hello.

Would it be possible to do a proper tagging for this project please?

Maybe good starting point is here: https://github.com/actions/checkout
They are using versions like:

  • v2 -> v2.0.0
  • v1 -> v1.2.0
  • v1.1.0
  • v1.0.0

It would be really handy to use something like v1 instead of specifying the exact version only v1.6.0:

    - uses: gaurav-nelson/github-action-markdown-link-check@v1

It will save me from changing the "exact versions" when you release new version.

For example this project can be handy for automating the release process: https://github.com/haya14busa/action-update-semver

Thank you...

False positive error raised (because of [email protected] dependency of markdown-link-check)

In my one of my repository I use this action (see workflow configuration

Since few days I have this error at each run:

ERROR: 1 dead links found!
[โœ–] https://github.com/oncleben31/home-assistant-config/workflows/Home%20Assistant%20configuration/badge.svg โ†’ Status: 404

If I clic the link in the action log, the expected image is displayed. I don't understand why the script detect a 404 error.

๐Ÿง Detects working links as not working for danielecook/Awesome-Bioinformatics

Hello there ๐Ÿ™‹โ€โ™‚๏ธ

This Action doesn't work very well with https://github.com/TGotwig/Awesome-Bioinformatics/tree/patch-2

The output is sometimes quite random from run to run and has always working links showing as not working ๐Ÿค”

 ERROR: 25 dead links found!
[โœ–] http://nextflow.io โ†’ Status: 0
[โœ–] https://software.broadinstitute.org/gatk โ†’ Status: 403
[โœ–] https://github.com/arq5x/bedtools2 โ†’ Status: 429
[โœ–] https://github.com/adamewing/bamsurgeon โ†’ Status: 429
[โœ–] https://github.com/lh3/wgsim โ†’ Status: 429
[โœ–] https://github.com/teamdfir/sift โ†’ Status: 429
[โœ–] https://github.com/pcingola/SnpEff โ†’ Status: 429
[โœ–] https://github.com/brentp/cruzdb โ†’ Status: 429
[โœ–] https://github.com/openvax/pyensembl โ†’ Status: 429
[โœ–] https://github.com/cokelaer/bioservices โ†’ Status: 429
[โœ–] https://github.com/arq5x/cyvcf โ†’ Status: 429
[โœ–] https://github.com/jamescasbon/PyVCF โ†’ Status: 429
[โœ–] https://github.com/brentp/cyvcf2 โ†’ Status: 429
[โœ–] https://github.com/daler/pybedtools โ†’ Status: 429
[โœ–] https://github.com/arq5x/bedtools โ†’ Status: 429
[โœ–] https://github.com/mdshw5/pyfaidx โ†’ Status: 429
[โœ–] https://github.com/pysam-developers/pysam โ†’ Status: 429
[โœ–] https://github.com/Lab41/squiggle โ†’ Status: 429
[โœ–] https://github.com/dasmoth/dalliance โ†’ Status: 429
[โœ–] https://github.com/biojs/biojs โ†’ Status: 429
[โœ–] http://biojs.net/ โ†’ Status: 0
[โœ–] https://github.com/jonathancrabtree/Circleator โ†’ Status: 429
[โœ–] https://github.com/drio/dnaism โ†’ Status: 429
[โœ–] https://github.com/igvteam/igv โ†’ Status: 429
[โœ–] http://watson.nci.nih.gov/cran_mirror/web/packages/RCircos/index.html โ†’ Status: 0

What it should look like:

 ERROR: 2 dead links found!
[โœ–] http://biojs.net/ โ†’ Status: 522
[โœ–] http://watson.nci.nih.gov/cran_mirror/web/packages/RCircos/index.html โ†’ Status: 

Allow `check-modified-files-only` to be used in combination with `file-extension`

As far as I can tell this:

for i in "${FILE_ARRAY[@]}"
do
if [ ${i: -3} = ".md" ]; then
FIND_CALL+=("${i}")
COMMAND="${FIND_CALL[@]}"
$COMMAND &>> error.txt || true
unset 'FIND_CALL[${#FIND_CALL[@]}-1]'
fi
done

is ignoring file-extension option altogether.

I would prepare a PR adding this functionality, but unfortunately, bash scripting is not my strongest suit. If nobody picks it up I might come back to take a stab at implementing this but this might take some time before I get to it.

Check for image links

I tested this action on my project and it works like a charm, thanks!
And it would be much appreciate if I can run this action against images, not just links of markdown files.

Status: 403 Forbidden for link in markdown link check, and 200 Ok in curl

Hi,
When I run markdown link check as Github Actions job I get failed job run with Status 403 for the link https://salesforce.by in logs. But when I check that link with curl on my local machine I get 200 Ok response code:

curl -I https://salesforce.by

HTTP/2 200 
server: nginx
date: Fri, 26 Jun 2020 15:32:40 GMT
content-type: text/html; charset=UTF-8
x-powered-by: PHP/5.6.38
set-cookie: dwqa_anonymous=APuKkgRGRNacmVfrcRWJAhR6QJRBQLs3723wQpiIw9Y; expires=Mon, 24-Jun-2030 15:32:40 GMT; Max-Age=315360000; path=/; secure; httponly
link: <https://salesforce.by/wp-json/>; rel="https://api.w.org/"


Feature: Add exclude parameter

Hello

Would it be possible to add the exclude parameter, which will skip the checks for certain files?

    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-verbose-mode: 'yes'
        config-file: 'mlc_config.json'
        exclude: "CHANGELOG.md"
        #or maybe better - set the find command parameters:
        #exclude: '-not -path ./node_modules/*'
        #exclude: '-not -name CHANGELOG.md'

Thank you

Ignore patterns

It would be great to have ignore patterns as described here https://github.com/tcort/markdown-link-check#config-file-format

As a concrete use case, I often link to crates.io. It always comes back as 404 to the link check (not sure why, also happens to other link checkers) and being able to ignore the entire site as opposed to individually annotating links with <!-- markdown-link-check-disable-next-line --> would be a big win.

Failed to download action

I'm trying your action but I've the following error message:

Current runner version: '2.157.5'
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@master'
Download action repository 'gaurav-nelson/[email protected]'
##[warning]Failed to download action 'https://api.github.com/repos/gaurav-nelson/github-action-markdown-link-check/tarball/v0.2.0'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 15.626 seconds before retry.
##[warning]Failed to download action 'https://api.github.com/repos/gaurav-nelson/github-action-markdown-link-check/tarball/v0.2.0'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 12.474 seconds before retry.
##[error]Response status code does not indicate success: 404 (Not Found).

I've copy paste your example in the README.

How to handle Jekyll liquids?

Hi,

we have an email link in markdown using Jekyll liquids like this:

[email](mailto:{{ site.email }})

The link check action recognizes this as a dead link. Is there a way to make it work with this kind of syntax?

I get this error when I use version 0.6.0 but works fine with 0.4.0

[Check Markdown Files/markdown-lint] โ˜ git clone 'https://github.com/gaurav-nelson/github-action-markdown-link-check' # ref=0.6.0
ERRO[0002] Unable to interpolate string '${{ inputs.use-quiet-mode }}' - [ReferenceError: 'quiet' is not defined]
ERRO[0002] Unable to interpolate string '${{ inputs.use-verbose-mode }}' - [ReferenceError: 'verbose' is not defined]
ERRO[0002] Unable to interpolate string '${{ inputs.config-file }}' - [ReferenceError: 'file' is not defined]
ERRO[0002] Unable to interpolate string '${{ inputs.folder-path }}' - [ReferenceError: 'path' is not defined]
[Check Markdown Files/markdown-lint] ๐Ÿณ docker build -t act-gaurav-nelson-github-action-markdown-link-check-0-6-0:latest /Users/lazy/.cache/act/[email protected]
[Check Markdown Files/markdown-lint] ๐Ÿณ docker run image=act-gaurav-nelson-github-action-markdown-link-check-0-6-0:latest entrypoint=[] cmd=["" "" "" ""]
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
/usr/local/bin/markdown-link-check -> /usr/local/lib/node_modules/markdown-link-check/markdown-link-check
| + [email protected]
| added 66 packages from 71 contributors in 2.418s
| USE_QUIET_MODE:
| USE_VERBOSE_MODE:
| FOLDER_PATH:
| Cannot find

I am using "act" to test the changes locally. See open-telemetry/opentelemetry-specification#541

Images are checked as if they're links

๐Ÿ‘‹ Hello there, I tested this action recently, and after the first test, I observed that images are checked as if they're links. Here's what I mean. Below you can find part of the log.

FILE: ./_posts/2018-04-27-WWDC Scholarship Application A Process in Review.md
[โœ–] /images/wwdc-post/passion.png
[โœ–] /images/wwdc-post/chapterOne.png
[โœ–] /images/wwdc-post/Submission-Status.png

As you can see above, this is a valid syntax for images, so I'm not sure why action checks them as if they're links.

Feature request: Add handling of "429 Too Many Requests" response

Hi, thank you for your nice checker!

I'd like to ask you to add new feature: ability to configure handling of cases when due to huge amount of requests the server starts to response with "429 Too Many Requests".

Here is my case - https://github.com/gleb-kosteiko/belarusian-it-communities. There are a bunch of links to Twitter accs and they are all alive. But in some moment for the rest of the twitter links (probably due to throttling) the checker starts to get "429 Too Many Requests":

ERROR: 18 dead links found!
[โœ–] https://twitter.com/angularbelarus/ โ†’ Status: 429
[โœ–] https://twitter.com/angularminsk โ†’ Status: 429
[โœ–] https://twitter.com/salesforce_by โ†’ Status: 429
[โœ–] https://twitter.com/BelarusKUG โ†’ Status: 429
[โœ–] https://twitter.com/CncfMinsk โ†’ Status: 429
.....

That would be nice to have some option to configure some interval between links checks or some other ways :)

Support for authentication?

I'm trying to use this against GitHub repos protected by SAML and need a way to navigate GitHub Authentication. Any support for auth?

Link with %20 has 404ed

Tried reverting to 1.0.2 and 1.0.7 because of the different version of the dependency.
Finally had to

"replacementPatterns": [
        {
          "pattern": "%20",
          "replacement": " "
        }
 ]

in mlc_config.json as a workaround.

Potentially connected with tcort/markdown-link-check#142

Add support for multiple files

Checking a whole repository takes much time.

markdown lint CLI solved that as follows:

markdownlint --help

  Usage: markdownlint [options] <files|directories|globs>

Would it be possible to also support multiple parameters to the action? In my concrete case, I would like to check README.md, CHANGELOG.md, and docs/ in one run.

Specify error codes that cause a failure.

I have a couple of links that fail like this:

[โœ–] http://distractionware.com/blog/2011/01/stop-and-reflect/ โ†’ Status: 403
[โœ–] https://www.uber.com โ†’ Status: 406

The links themselves are fine, it's just the server doesn't support the GET request. Can there be some way to configure which 4XX codes result in an error?

Awesome plugin by the way, really getting a lot of value with this!

Warning "Cannot find mlc_config.json"

I've installed this action in my repo https://github.com/ChristopherA/Lists-of-High-Signal-Low-Noise-Links

I'm using the default suggested template in my .github/workflows/check-actions.yml file:

name: Check Markdown links

on: push

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1

The script reports an a warning "Cannot find mlc_config.json" (for example see https://github.com/ChristopherA/Lists-of-High-Signal-Low-Noise-Links/runs/590748306?check_suite_focus=true):

Cannot find mlc_config.json
NOTE: See https://github.com/tcort/markdown-link-check#config-file-format to know more about customizing markdown-link-check by using a configuration file.

Otherwise the script is running ok.

-- Christopher Allen

Readme with broken links still passes

I am testing this with some broken links as seen here but everything still passes. This is the action .yml file

name: Check Markdown links

on: 
  push:
    branches:
    - main

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-verbose-mode: 'yes'
        check-modified-files-only: 'yes'
        base-branch: 'main'

I cannot see what might be wrong in my .yml file to get this working?

Is there a way to see what urls have been tested?

Thanks
Tahir

Add support for .gitignore

Currently, ignored paths are hared-coded.

Would it be possible to read the .gitignore and ignore listed files and directories?

find /docs -name '*.md' -not -path './node_modules/*'

(Not sure how hard this is. Just an enhancement idea. Low priority. Just thought of it as workaround for #41)

check-modified-files-only ignores the folder-path

If I set check-modified-files-only: true, the link checker ignores the folder-path I have set.

Here's the workflow:

link_checker:
  # https://github.com/gaurav-nelson/github-action-markdown-link-check
  runs-on: ubuntu-latest
  steps:
  - name: Checkout
    uses: actions/checkout@v2
    with:
      submodules: false
  - name: Check markdown links
    uses: gaurav-nelson/github-action-markdown-link-check@master
    with:
      config-file: .mlc_config.json
      # only check the docs folder
      folder-path: 'docs'
      use-quiet-mode: yes
      use-verbose-mode: yes
      check-modified-files-only: yes

This repository includes a bunch of old files that we're not publishing, in a folder called .unpublished. These files are bound to have dead links.

Sample run output. Note the FOLDER_PATH, and the very first file it checks:

Using markdown-link-check configuration file: .mlc_config.json
USE_QUIET_MODE: yes
USE_VERBOSE_MODE: yes
FOLDER_PATH: docs
MAX_DEPTH: -1
CHECK_MODIFIED_FILES: yes
FILE_EXTENSION: .md
FILE_PATH: 
BASE_BRANCH: master
From https://github.com/[redacted]
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
=========================> MARKDOWN LINK CHECK <=========================

FILE: .unpublished/events-08-19/functions/libraries.md
[โœ–] https://<servername removed>/docs/platform/functions/ โ†’ Status: 404

[...further lines removed...]

File Extension test doesn't match with default on check-modified-files-only

I have been using this config:

name: Check Markdown links

on:
  pull_request

jobs:
  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1
      with:
        use-quiet-mode: 'no'
        use-verbose-mode: 'yes'
        config-file: './.github/mlc_config.json'
        check-modified-files-only: 'yes'

While my own tests work locally with the command line tool, the action workflow never checks any file.

I forked the repo and added a bit of echo logging so i could test exactly what was going on. The extension test fails as it strips the leading . off the extension of the modified file as shown in this screen shot.

image

I cannot share the run log as it is from a private repo.

When I update the workflow yaml config with the file_extension: md this works around the issue:

image

Here's some of the solution options I am think about:

  • Update the default parameter value?
  • Update the documentation?
  • Update the if [ "${i##*.}" = "${FILE_EXTENSION}" ]; then code to ensure it includes the leading .

Thoughts? I'm happy to contribute once I know the direction you would like to take it.

skip HTTP 429 errors

Hello

I had a case of ERROR: 1 dead links found! for a Status: 429: Too Many Requests.
Is there a way to ignore such intermittent error?

Thanks

Check for links to subsections

I was wondering whether it is possible to check for links to subsections such as [thing](#link_to_sections_explaining_thing)

Is it already possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.