-
Notifications
You must be signed in to change notification settings - Fork 246
workflow/verify links #819
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 1 commit
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,69 @@ | ||||||
name: Verify links | ||||||
|
||||||
on: | ||||||
push: | ||||||
branches: | ||||||
- main | ||||||
- workflow/verify-links # TODO REMOVE | ||||||
repository_dispatch: | ||||||
workflow_dispatch: | ||||||
schedule: | ||||||
- cron: "08 08 * * 1" | ||||||
|
||||||
jobs: | ||||||
linkChecker: | ||||||
runs-on: ubuntu-latest | ||||||
permissions: | ||||||
issues: write # required for peter-evans/create-issue-from-file | ||||||
steps: | ||||||
- uses: actions/checkout@v4 | ||||||
|
||||||
- name: Restore lychee cache | ||||||
uses: actions/cache@v4 | ||||||
with: | ||||||
path: .lycheecache | ||||||
key: cache-lychee-${{ github.sha }} | ||||||
restore-keys: cache-lychee- | ||||||
|
||||||
- name: Link Checker | ||||||
id: lychee | ||||||
uses: lycheeverse/lychee-action@v2 | ||||||
with: | ||||||
fail: false | ||||||
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. if I understand right this does not affect the following step and its check |
||||||
# Exclude all private and local addresses in the check | ||||||
# Also exclude domains that actively block GitHub to send requests | ||||||
# Any Cockpit URLs it finds that have variables will be ignored too | ||||||
args: | | ||||||
--max-concurrency 1 | ||||||
--retry-wait-time 60 | ||||||
--base . | ||||||
--skip-missing | ||||||
--exclude-all-private | ||||||
--exclude '^https://linux.die.net' | ||||||
|
||||||
--exclude 'file:///' | ||||||
--exclude 'domain.tld' | ||||||
--exclude '^.*\{\{' | ||||||
--exclude 'https://bodhi.fedoraproject.org/updates/cockpit-*' | ||||||
--cache | ||||||
--cache-exclude-status 400..=599 | ||||||
--max-cache-age 1d | ||||||
-v | ||||||
. | ||||||
token: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
||||||
- name: Find the last open report issue | ||||||
if: steps.lychee.outputs.exit_code != 0 | ||||||
|
||||||
id: last-issue | ||||||
uses: micalevisk/last-issue-action@v2 | ||||||
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 one seems to be dead for 2 years without releases and I am slightly concerned about supply chain attacks here. It essentially does one query which seems to be trivially rewritten in JavaScript in the workflow like we do for
But then Getting the issue might be as simple as 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. We could use the hash for taking the release and update it with Renovate when there are new versions (if ever). Would at least ensure that the release itself is the one we expect.
Suggested change
But yeah might be better to use something like that if it works |
||||||
with: | ||||||
state: open | ||||||
labels: link-checker | ||||||
|
||||||
- name: Update or create issue report | ||||||
if: steps.lychee.outputs.exit_code != 0 && steps.last-issue.outputs.has-found == 'true' | ||||||
uses: peter-evans/create-issue-from-file@v5 | ||||||
with: | ||||||
title: Link Checker Report | ||||||
content-filepath: ./lychee/out.md | ||||||
issue-number: ${{ steps.last-issue.outputs.issue-number }} | ||||||
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. What is no issue is found? Does this accept null? 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. It is an optional field so yeah it would parse as not having provided any. In this repo I see that they were successful with this approach: So it should work for us too. Their approach is to keep the issue open and update it regardless if the link checker failed or not. Whereas in this PR I've set it so it opens an issue or updates an existing one if something fails. So there is a slight difference. They also have a step to close the issue which we could adopt (though theirs doesn't work atm due to their if-statement it seems). |
||||||
labels: link-checker |
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.
Not sure if anyone watched scheduled jobs, for Cockpit we make issues. Owners will spot these issues but not sure if anyone else would.
Did you try running lychee locally? Because without any changes it generates this:
It also will require a GITHUB_TOKEN otherwise we run into rate limits.