-
-
Notifications
You must be signed in to change notification settings - Fork 302
ci: add link checker #1696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ci: add link checker #1696
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Links | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| schedule: | ||
| - cron: "00 18 * * *" | ||
|
|
||
| jobs: | ||
| linkChecker: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write # required for peter-evans/create-issue-from-file | ||
| pull-requests: write # required for github-script to comment on PRs | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Link Checker | ||
| id: lychee | ||
| uses: lycheeverse/lychee-action@v2 | ||
| with: | ||
| args: . --exclude-path "tests" | ||
| fail: false | ||
|
|
||
| # - name: Create or Update PR Comment | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBD
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probbaly use it to create an issue instead of a PR?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed, let's start with an issue |
||
| # if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'pull_request' | ||
| # uses: actions/github-script@v8 | ||
| # with: | ||
| # script: | | ||
| # const fs = require('fs'); | ||
| # const commentMarker = '<!-- link-checker-report -->'; | ||
|
|
||
| # // Read the report file if it exists, otherwise use a fallback message | ||
| # let body; | ||
| # if (fs.existsSync('./lychee/out.md')) { | ||
| # body = fs.readFileSync('./lychee/out.md', 'utf8'); | ||
| # } else { | ||
| # body = '## 🔗 Link Checker Report\n\nThe link checker found broken links in this pull request. Please check the workflow logs for details.'; | ||
| # } | ||
|
|
||
| # // Add the marker to identify this comment | ||
| # body = commentMarker + '\n\n' + body; | ||
|
|
||
| # // Get existing comments on the PR | ||
| # const { data: comments } = await github.rest.issues.listComments({ | ||
| # owner: context.repo.owner, | ||
| # repo: context.repo.repo, | ||
| # issue_number: context.issue.number, | ||
| # }); | ||
|
|
||
| # // Find existing comment with our marker | ||
| # const existingComment = comments.find(comment => | ||
| # comment.user.type === 'Bot' && | ||
| # comment.body.includes(commentMarker) | ||
| # ); | ||
|
|
||
| # if (existingComment) { | ||
| # // Update existing comment | ||
| # await github.rest.issues.updateComment({ | ||
| # owner: context.repo.owner, | ||
| # repo: context.repo.repo, | ||
| # comment_id: existingComment.id, | ||
| # body: body, | ||
| # }); | ||
| # } else { | ||
| # // Create new comment | ||
| # await github.rest.issues.createComment({ | ||
| # owner: context.repo.owner, | ||
| # repo: context.repo.repo, | ||
| # issue_number: context.issue.number, | ||
| # body: body, | ||
| # }); | ||
| # } | ||
|
|
||
| # - name: Create Issue From File | ||
| # if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule' | ||
| # uses: peter-evans/create-issue-from-file@v5 | ||
| # with: | ||
| # title: Link Checker Report | ||
| # content-filepath: ./lychee/out.md | ||
| # labels: 'type: documentation' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency