-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[CI] Add lychee link checker workflow #12931
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: main
Are you sure you want to change the base?
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,62 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # To run similar tasks locally, install lychee and run the following at the root of the repository: | ||
| # lychee . | ||
|
|
||
| name: Links | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| schedule: | ||
| - cron: '9 1 * * 0' # At 01:09 on Sunday. | ||
|
|
||
| jobs: | ||
| check-links: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write # required for Broken Links Report | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Link Checker | ||
| id: lychee | ||
| uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0 | ||
|
Collaborator
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. No GITHUB_TOKEN in the env, so github.com links get rate limited and come back looking broken. Worth adding? |
||
| with: | ||
| args: --config lychee.toml . | ||
| fail: false | ||
|
Collaborator
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. fail: false here, and the report step only runs on schedule. So on a PR this always goes green and prints nothing. Is that intended, or should PRs surface the broken links somewhere? |
||
|
|
||
| - name: Broken Links Report | ||
| if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule' | ||
| uses: actions/github-script@v8 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
|
|
||
| // Read the markdown file | ||
| // Ensure the path is correct relative to the workspace root | ||
| const reportBody = fs.readFileSync('./lychee/out.md', 'utf8'); | ||
|
|
||
| await github.rest.issues.create({ | ||
|
Collaborator
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. This opens a new issue every Sunday. Should it update an existing open one instead? |
||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: 'Broken Links Report', | ||
| body: reportBody | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| exclude = [ | ||
| "https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.1/html/Release_Notes/version-4.2.html#issues-fixed-4.2.1", | ||
| "https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.0/html/Release_Notes/index.html", | ||
| "https://cloudstack.apache.org/survey.html", | ||
| "https://downloads.chef.io/chef-dk/", | ||
| "https://github.com/YOUR_ACCOUNT/cloudstack", | ||
| "https://iconka.com/en/downloads/cat-power/", | ||
| "https://issues.apache.org/.*", | ||
|
Collaborator
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. This skips every Jira link in the repo. Can we narrow it once we see what actually breaks? |
||
| "http://localhost:5050/", | ||
| "https://markmail.org/.*", | ||
| "https://viserjs.github.io/docs.html#/viser/guide/installation"] | ||
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.
Every other workflow here pins actions by SHA. Pin this one and github-script below to match?