Skip to content

governance.link-checker #228

governance.link-checker

governance.link-checker #228

# @todo: sync with other repositories
---
name: governance.link-checker
# Run action on pull request event
on:
push:
branches:
- $default-branch
paths:
- '*.md'
pull_request:
types: [opened, edited]
paths:
- '*.md'
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:
env:
TEMPLATE: .github/templates/issue.links.md
LYCHEE_OUT: out.md
USER_AGENT: "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
jobs:
markdown-link-check:
runs-on: ubuntu-latest
if: github.repository == 'ivankatliarchuk/.github'
steps:
# checkout to latest commit
- uses: actions/[email protected]
# run markdown linter
# todo https://github.com/peter-evans/link-checker
- name: link checker
id: lychee
uses: lycheeverse/[email protected]
# if: failure()
with:
args: >
--exclude="^(javascript|chrome):.*"
--exclude "^git"
--exclude "^file://"
--verbose
--no-progress
--accept=200,403,429
--timeout 20
"*.md"
"**/*.md"
"README.md"
"*.toml"
"**/*.toml"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: read output
id: readfile
uses: juliangruber/[email protected]
if: ${{ steps.lychee.outputs.exit_code > 0 }}
with:
path: ${{ env.LYCHEE_OUT }}
- name: results
id: read
run: |
echo "exit code: ${{ steps.lychee.outputs.exit_code }}"
- name: update issue template
uses: DamianReeves/write-file-action@master
if: ${{ steps.lychee.outputs.exit_code > 0 }}
with:
path: .github/templates/issue.links.md
contents: ${{ steps.readfile.outputs.content }}
write-mode: append
- name: create issue from file
uses: JasonEtco/[email protected]
id: issue
if: ${{ steps.lychee.outputs.exit_code > 0 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: 'Markdwon links checker'
with:
filename: ${{ env.TEMPLATE }}
assignees: ${{ github.repository_owner }}
update_existing: true
- name: fail if there were link errors
run: exit ${{ steps.lychee.outputs.exit_code }}