Skip to content

get shit done

get shit done #448

name: governance.link-checker
# Run action on pull request event
on:
push:
branches:
- master # Set a branch to deploy
paths:
- 'docs/**/*.md'
pull_request:
types: [opened, edited]
paths:
- 'docs/**/*.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
steps:
# checkout to latest commit
- uses: actions/checkout@v4.1.6
with:
fetch-depth: 1
# run markdown linter
# - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15
# todo https://github.com/peter-evans/link-checker
- name: link checker
id: lychee
uses: lycheeverse/lychee-action@v1.10.0
# if: failure()
with:
args: >
--exclude="^(javascript|chrome):.*"
--exclude "^git"
--exclude "^file://"
--verbose
--no-progress
--accept=200,403,429
--timeout 20
"*.md"
"README.md"
"docs/**/*.md"
"*.toml"
"**/*.toml"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: read '${{ env.LYCHEE_OUT }}'
id: readfile
uses: juliangruber/read-file-action@v1.1.7
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/create-an-issue@v2.9.2
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 }}