diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 0000000..db32f94 --- /dev/null +++ b/.github/workflows/check-links.yml @@ -0,0 +1,54 @@ +name: Check Links + +on: + pull_request: + branches: + - main + +# commenting needs these +permissions: + pull-requests: write + + +jobs: + lychee: + strategy: + matrix: + tags: ["0.1.0", "0.2.0", "0.2.1", "0.3.0"] + + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + persist-credentials: false + + - name: Link Checker in the book + uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2 + with: + args: --root-dir tags/${{ matrix.tags }}/book --require-https --no-progress --include-fragments --include-verbatim tags/${{ matrix.tags }}/book + fail: false + + - name: Format summary for comment + run: | + echo "# Summary ${{ matrix.tags }}" > summary-comment.md + # Only keep the # Summary header and the table by deleting every thing after a ## Then add the matrix info to the heading + sed '/^##\s/,/$EOF/{d}' lychee/out.md | sed 's/^# Summary/## Book/g' >> summary-comment.md + + - name: Link Checker in the api docs + uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2 + with: + args: --root-dir tags/${{ matrix.tags }}/api --require-https --no-progress --include-fragments --include-verbatim tags/${{ matrix.tags }}/api + fail: false + + - name: Format summary for comment + run: | + # Only keep the # Summary header and the table by deleting every thing after a ## then + sed '/^##\s/,/$EOF/{d}' lychee/out.md | sed 's/^# Summary/## Api docs/g' >> summary-comment.md + + - name: Comment Summary on PR + uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 + with: + header: ${{ matrix.tags }} + path: summary-comment.md \ No newline at end of file