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

git hook should check if pkgdown is up to date #2108

Open
dmurdoch opened this issue Feb 26, 2025 · 1 comment
Open

git hook should check if pkgdown is up to date #2108

dmurdoch opened this issue Feb 26, 2025 · 1 comment

Comments

@dmurdoch
Copy link

dmurdoch commented Feb 26, 2025

If I add a new function to my package but forget to add it to _pkgdown.yml, then the pkgdown build on Github will fail. It would be nice if one of the git hooks wouid warn me about this.

I'm not sure if the warning should be a pre-commit or pre-push warning.

Currently I don't have a pre-push hook, but I have a pre-commit hook that checks that README.md has been updated after README.Rmd was changed. I believe that hook was installed by usethis::use_readme_rmd(). I don't think anything in usethis installs a pre-push hook, so it would probably be easiest to do that, so you don't need to worry about merging the two hooks. I think usethis::use_pkgdown() would be the place to put it.

A test could be that if NAMESPACE is newer than docs/reference/index.html, it could suggest running pkgdown::build_site() or maybe pkgdown::build_reference(), which should update the index file.

@dmurdoch
Copy link
Author

The test I suggested above is not sufficient. I just split a help page that was covering multiple functions into separate help pages, and that was enough to cause build_site() to fail. So maybe the test should be something like trying to run pkgdown::build_reference_index().

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

No branches or pull requests

1 participant