https://github.com/peter-evans/link-checker
A GitHub action for link checking repository Markdown and HTML files
https://github.com/peter-evans/link-checker
github-action github-issues html link-checker markdown
Last synced: 2 months ago
JSON representation
A GitHub action for link checking repository Markdown and HTML files
- Host: GitHub
- URL: https://github.com/peter-evans/link-checker
- Owner: peter-evans
- License: mit
- Archived: true
- Created: 2019-07-12T14:47:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T20:50:33.000Z (over 3 years ago)
- Last Synced: 2025-04-22T06:18:07.412Z (3 months ago)
- Topics: github-action, github-issues, html, link-checker, markdown
- Language: Shell
- Homepage:
- Size: 21.5 KB
- Stars: 49
- Watchers: 4
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Link Checker
[](https://github.com/marketplace/actions/link-checker)### :warning: This action is deprecated. Please consider using [lychee-action](https://github.com/lycheeverse/lychee-action).
A GitHub action for link checking repository Markdown and HTML files.
When used in conjunction with [Create Issue From File](https://github.com/peter-evans/create-issue-from-file), issues will be created when Link Checker finds connectivity problems with links.
## Usage
Using with the default settings will check all markdown and HTML files in your repository.
```yml
- name: Link Checker
uses: peter-evans/link-checker@v1
```Link Checker uses [Liche](https://github.com/raviqqe/liche).
Liche arguments can be passed to the action via the `args` parameter. If not set, the default `-v -r *` will be used.```yml
- name: Link Checker
uses: peter-evans/link-checker@v1
with:
args: -v -r *
```See [Liche's documentation](https://github.com/raviqqe/liche) for further argument details.
#### Optional environment variables
If Link Checker finds connectivity problems with links the action will output a markdown file containing the error report.
The default path is `link-checker/out.md`. The path and filename may be overridden with the following variables.- `LINKCHECKER_OUTPUT_DIR` - The output directory the markdown error report
- `LINKCHECKER_OUTPUT_FILENAME` - The error report filename#### Receiving issues containing the error report
Below is an example of using this action in conjunction with [Create Issue From File](https://github.com/peter-evans/create-issue-from-file). The workflow executes on a schedule every month. Issues will be created when Link Checker finds connectivity problems with links.
```yml
on:
schedule:
- cron: '0 0 1 * *'
name: Check markdown links
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Link Checker
uses: peter-evans/link-checker@v1
- name: Create Issue From File
uses: peter-evans/create-issue-from-file@v2
with:
title: Link Checker Report
content-filepath: ./link-checker/out.md
labels: report, automated issue
```#### Issue sample
[This link](https://aoushaoueshosuhoshuoeu.com) is intentionally non-existent.
The workflow in this repository generated [this sample issue](https://github.com/peter-evans/link-checker/issues/1).#### Creating a failing check for link errors
To create a failing check when there are link errors you can use the `exit_code` output from the action as follows.
```yml
on: push
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Link Checker
id: lc
uses: peter-evans/link-checker@v1
- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}
```## License
[MIT](LICENSE)