Skip to content

Don't run go tests when only docs are changed #7497

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

Open
sspaink opened this issue Apr 4, 2025 · 6 comments
Open

Don't run go tests when only docs are changed #7497

sspaink opened this issue Apr 4, 2025 · 6 comments
Labels
github_actions Pull requests that update GitHub Actions code

Comments

@sspaink
Copy link
Contributor

sspaink commented Apr 4, 2025

Short description

Noticed in a recent PR that only changed one markdown file the entire Go workflow is run (build, tests, linting). We can detect what files are changed and only run the necessary checks. Not sure if there is a native way to do this in Github Actions but could use this project: https://github.com/dorny/paths-filter to filter based on files changed.

Expected behavior

Only the required tests are run depending on the files changed in the PR.

@sspaink sspaink added bug github_actions Pull requests that update GitHub Actions code and removed bug labels Apr 4, 2025
@srenatus
Copy link
Contributor

srenatus commented Apr 7, 2025

This goes both ways, doesn't it? If a change only affects Go code, why build the docs on the PR?

@sspaink
Copy link
Contributor Author

sspaink commented Apr 7, 2025

Good point! Would it be safe to assume that if nothing changed in the docs directory then the docs shouldn't be generated?

@srenatus
Copy link
Contributor

srenatus commented Apr 7, 2025

Re: paths-filter, if we can get by with the simple built-in stuff, that would perhaps be better.

If I remember correctly, the website builds are triggered from netlify, I don't know if it's easy to make them conditional... 🤔

Would it be safe to assume that if nothing changed in the docs directory then the docs shouldn't be generated?

I think it's at least a good enough approximation. Even if something, like auto-generated CLI parameter docs, technically brings in a dependency between the Go code and the website (I might misremember things!), we still have a full build of the website on every push to main. (This is something to also reconsider, to waste less resources.)

@srenatus
Copy link
Contributor

srenatus commented Apr 7, 2025

To be clear, any small improvement is well worth the while here. We don't need pull this all off right away.

@srenatus
Copy link
Contributor

srenatus commented Apr 8, 2025

Just remembered that we already skip the website build if it's deemed unnecessary 😅 3b01b9a

@charlieegan3
Copy link
Contributor

charlieegan3 commented Apr 8, 2025

I think something like this would be preferred (over a new action step):

on:
  push:
    paths-ignore:
      - 'docs/**'

However, it'd involve breaking down our pr.yaml into separate workflows. I'm unsure if that's worse, I guess it means things are in lots of places...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code
Projects
None yet
Development

No branches or pull requests

3 participants