Add formatters, pre-commit checks, ci, etc. #4
Workflow file for this run
This file contains 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
name: Pre-commit checks | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Need to grab the history of the PR | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2023-03-01 | |
components: rustfmt, clippy | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2023-07-23 | |
components: rustfmt, clippy | |
- uses: pre-commit/[email protected] | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
# Run only on files changed in the PR | |
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} | |
- uses: pre-commit/[email protected] | |
if: ${{ github.event_name != 'pull_request' }} |