Repository navigation
ci(prek): add language caching and use PR base/head refs - #3
Merged
Merged
Conversation
This pull request enhances the reusable prek workflow with language-specific caching, more robust pull request handling, and new configurable inputs. The main changes are grouped below. **Language caching support:** * Added a `Set up Go and restore Go caches` step that runs `actions/setup-go` when a Go version file is present, with caching keyed on `go.mod` and `go.sum`. * Added a `Restore Rust caches` step using `Swatinem/rust-cache` when a `Cargo.toml` is present, saving only on pushes to the default branch. * Updated the prek hook cache key to include both `.pre-commit-config.yaml` and `.prek-config.yaml`. **Pull request handling improvements:** * Switched pull request detection to `github.event_name == 'pull_request'` and used the base/head SHAs for the diff range instead of `origin/main`. * Generalized default branch checks to use `github.event.repository.default_branch` instead of a hardcoded `main`. **New workflow inputs:** * Added `go_version_file` input to control which file the Go setup reads the version from. * Added `prek_skip` input to skip hooks, files, or stages during the prek run. * Changed `run_all_files` to a boolean type and improved input descriptions. **Miscellaneous:** * Bumped action versions for checkout, cache, and setup-go.
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the reusable prek workflow with language-specific caching, more robust pull request handling, and new configurable inputs. The main changes are grouped below.
Language caching support:
Set up Go and restore Go cachesstep that runsactions/setup-gowhen a Go version file is present, with caching keyed ongo.modandgo.sum.Restore Rust cachesstep usingSwatinem/rust-cachewhen aCargo.tomlis present, saving only on pushes to the default branch..pre-commit-config.yamland.prek-config.yaml.Pull request handling improvements:
github.event_name == 'pull_request'and used the base/head SHAs for the diff range instead oforigin/main.github.event.repository.default_branchinstead of a hardcodedmain.New workflow inputs:
go_version_fileinput to control which file the Go setup reads the version from.prek_skipinput to skip hooks, files, or stages during the prek run.run_all_filesto a boolean type and improved input descriptions.Miscellaneous: