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

Only run linkcheck on changed files #886

Closed
camelid opened this issue Sep 22, 2020 · 5 comments · Fixed by #913
Closed

Only run linkcheck on changed files #886

camelid opened this issue Sep 22, 2020 · 5 comments · Fixed by #913

Comments

@camelid
Copy link
Member

camelid commented Sep 22, 2020

From @mark-i-m in this Zulip thread:

It doesn't sound too hard to add a way for mdbook-linkcheck to only check a list of given files. Then, we could have the CI script list the changed files from git as those arguments and only check the changed files. And we could have a cron job that runs the full check periodically (like we already do).

This would probably reduce the number of the annoying 429 Too Many Requests errors.

@camelid
Copy link
Member Author

camelid commented Sep 23, 2020

We could get the list of changed files with this command:

$ git diff-tree --no-commit-id --name-only -r HEAD
src/const-eval.md

This command is a plumbing command according to this Stack Overflow answer, so it should be fine to use in a script. The output looks good, it just lists each changed file on a newline.

Is it possible to only check certain files with mdbook-linkcheck?

@mark-i-m
Copy link
Member

Is it possible to only check certain files with mdbook-linkcheck?

TMK, no, but it looks like it wouldn't be too hard to add... it looks like you could add a flag to mdbook-linkcheck and plumb it through to here: https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/b6409a631f7294eeadca7cf9d77985488086ac67/src/lib.rs#L160 Then, just filter out the files you don't want...

@camelid
Copy link
Member Author

camelid commented Sep 23, 2020

Opened Michael-F-Bryan/mdbook-linkcheck#41.

@mark-i-m
Copy link
Member

Also useful: https://docs.travis-ci.com/user/cron-jobs/#detecting-builds-triggered-by-cron

With this we can leave off the aforementioned flag in cron jobs to get the full build.

@mark-i-m
Copy link
Member

mark-i-m commented Oct 5, 2020

Michael-F-Bryan/mdbook-linkcheck#41 has merged... I'll try to put up some sort of PR soon...

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 a pull request may close this issue.

2 participants