Skip to content
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

update PR link checker workflow #347

Merged
merged 2 commits into from
Oct 2, 2024
Merged

Conversation

egpbos
Copy link
Member

@egpbos egpbos commented Sep 29, 2024

Fixes #345.

Use a different changed-files checker (the old one was no longer maintained) and also make the link checking more fine-grained by only checking added lines for broken links.

We now use a matrix to parallelize over changed files. This slows down the complete workflow a bit in some cases, but it does offer a nicer user experience, because the files that are checked will now be shown in the GitHub UI itself, instead of only in the workflow run logs.

Lychee is installed directly from the GitHub nightly release. This is really fast. The original reason, though, was because there is no Ubuntu package for Lychee. Works out well, though.

Determining the base SHA is a bit convoluted, because GitHub does not provide this in a usable way. See
https://www.kenmuse.com/blog/the-many-shas-of-a-github-pull-request/ for a good overview of this problem. The git rev-parse command was suggested there. The fetch depth must be at least two, otherwise the base SHA cannot be used.

Use a different changed-files checker (the old one was no longer
maintained) and also make the link checking more fine-grained by only
checking added lines for broken links.

We now use a matrix to parallelize over changed files. This slows down
the complete workflow a bit in some cases, but it does offer a nicer
user experience, because the files that are checked will now be shown in
the GitHub UI itself, instead of only in the workflow run logs.

Lychee is installed directly from the GitHub nightly release. This is
really fast. The original reason, though, was because there is no Ubuntu
package for Lychee. Works out well, though.

Determining the base SHA is a bit convoluted, because GitHub does not
provide this in a usable way. See
https://www.kenmuse.com/blog/the-many-shas-of-a-github-pull-request/ for
a good overview of this problem. The git rev-parse command was suggested
there. The fetch depth must be at least two, otherwise the base SHA
cannot be used.
@egpbos egpbos force-pushed the update_link_checker_PR_workflow_squash branch from 7919971 to f2b5aca Compare September 29, 2024 15:56
Copy link
Member

@ewan-escience ewan-escience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change generates an error (see https://github.com/NLeSC/guide/actions/runs/11094013550), but I think that is because no MarkDown files have changed? So let's hope it works... 🤞

@egpbos
Copy link
Member Author

egpbos commented Oct 2, 2024

@ewan-escience ah that's sloppy, thanks. I hadn't noticed because the workflows themselves seem to pass, the error comes from the Actions execution backend it seems.

@egpbos
Copy link
Member Author

egpbos commented Oct 2, 2024

Solution here dorny/paths-filter#66

@egpbos
Copy link
Member Author

egpbos commented Oct 2, 2024

Nice, now it explicitly says it skips it.

Btw, I tested the solution itself in my own fork: egpbos#1 You can see there how it should work here as well if I squashed things correctly 😄 I didn't want to pollute this PR with tests.

@egpbos egpbos merged commit c0d1021 into main Oct 2, 2024
2 checks passed
@egpbos egpbos deleted the update_link_checker_PR_workflow_squash branch October 2, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade GitHub workflows
2 participants