Check documentation links #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Checks documentation for broken links once per day and creates issues if broken links are found | |
| name: Check documentation links | |
| on: | |
| workflow_call: | |
| inputs: | |
| fail-fast: | |
| required: false | |
| default: false | |
| type: boolean | |
| schedule: | |
| # runs once a day at 01:00 UTC (adjust as needed) | |
| - cron: '0 1 * * *' | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| linkChecker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set fail-fast flag depending on trigger | |
| id: flags | |
| run: | | |
| if [ "${{ github.event_name }}" = "schedule" ]; then | |
| echo "fail_fast=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "fail_fast=${{ inputs.fail-fast }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Link Checker | |
| id: lychee | |
| uses: lycheeverse/lychee-action@v2.0.2 | |
| with: | |
| fail: ${{ steps.flags.outputs.fail_fast }} | |
| args: | | |
| --verbose | |
| --exclude-mail | |
| --exclude "localhost" | |
| --exclude "127.0.0.1" | |
| --exclude "^file://" | |
| --exclude "github.com/0xMiden/.*" | |
| --exclude "medium.com" | |
| docs/src/**/*.md | |
| **/*.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Open issue on failure (only if fail-fast is false) | |
| if: steps.lychee.outputs.exit_code != 0 && steps.flags.outputs.fail_fast != 'true' | |
| uses: peter-evans/create-issue-from-file@v5 | |
| with: | |
| title: Link Checker Report | |
| content-filepath: ./lychee/out.md | |
| labels: documentation |