stackabletech / issues

This repository is only for issues that concern multiple repositories or don't fit into any specific repository
2 stars 0 forks source link

fix: pre-commit in workflows need to compare against origin/HEAD #616

Open NickLarsenNZ opened 3 months ago

NickLarsenNZ commented 3 months ago

Currently the pre-commit checks are not picking up problems, because it is skipping all checks in CI

Image

As @Techassi found in the docs: https://pre-commit.com/#usage-in-continuous-integration, it needs to be run with extra options:

# pre-commit run --from-ref origin/HEAD --to-ref HEAD
pre-commit run --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}

For each fix, do the following:

### Repositories that need fixing
- [ ] https://github.com/stackabletech/docker-images/pull/790
- [ ] docker-images pre-commit hook pinning
- [ ] operator-templating
- [ ] stackable-cockpit
NickLarsenNZ commented 3 months ago

Similar changes would need to be made in other repositories such as:

NickLarsenNZ commented 3 months ago

Ok, this is a bit more complicated in Github Actions, because there is only one ref:

$ git show-ref
d0de6cda5ad2e24366f07ad20f1f786ae2688116 refs/remotes/pull/790/merge

So, we need to use some github event data: https://github.com/pre-commit/action/issues/7#issuecomment-1251300704

NickLarsenNZ commented 3 months ago

Related: https://github.com/actions/checkout/issues/910