Skip to content

Check broken links #1951

Check broken links

Check broken links #1951

Workflow file for this run

name: Check broken links
on:
schedule:
- cron: '0 8 * * *'
# Triggers the workflow on push or pull request events
push:
branches: [ main ]
paths:
- '**.md'
pull_request:
paths:
- '**.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
LinkChecker:
name: Link Checker
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
actions: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Lychee Broken Link Checker
uses: lycheeverse/lychee-action@v2.1.0
with:
# Check all markdown files in repo
args: --base ./docs --user-agent 'curl/8.9.0' -vvv --no-progress --max-redirects 100 --accept 200,403,429,500 './**/*.md'
fail: true
# To avoid automated spam, try to find an existing open issue before opening a new one
# Source: https://github.com/cilium/tetragon/pull/805
- name: Search for existing issue number
id: search-issue
if: always()
run: |
encoded_issue_name=$(echo "$ISSUE_NAME" | sed 's/ /%20/g')
response=$(curl -s -X GET "https://api.github.com/search/issues?q=$encoded_issue_name+repo:sandboxie-plus/sandboxie-docs+state:open+label:automated-report&type=Issues")
issue_number=$(echo "$response" | jq -r '.items[0].number // empty')
echo "issue_number=$issue_number" >> $GITHUB_OUTPUT
- name: Create issue from file
if: always() && env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
issue-number: ${{ steps.search-issue.outputs.issue_number }}
labels: automated-report