chore: autocommit lint fixes #10
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
# ------------------------------------------------------------------- | |
# ------------------------------- WARNING --------------------------- | |
# ------------------------------------------------------------------- | |
# | |
# This file was automatically generated by gh-workflows using the | |
# gh-workflow-gen bin. You should add and commit this file to your | |
# git repository. **DO NOT EDIT THIS FILE BY HAND!** Any manual changes | |
# will be lost if the file is regenerated. | |
# | |
# To make modifications, update your `build.rs` configuration to adjust | |
# the workflow description as needed, then regenerate this file to apply | |
# those changes. | |
# | |
# ------------------------------------------------------------------- | |
# ----------------------------- END WARNING ------------------------- | |
# ------------------------------------------------------------------- | |
name: autofix.ci | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- labeled | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: read | |
packages: read | |
jobs: | |
lint: | |
name: Run Formatter and Lint Check | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
env: | |
LINT_MODE: '${{contains(github.event.pull_request.labels.*.name, ''ci: lintfix'') && ''fix'' || ''check''}}' | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Print $LINT_MODE | |
run: echo $LINT_MODE | |
env: | |
LINT_MODE: ${{ env.LINT_MODE }} | |
- name: Setup Rust Toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable, nightly | |
components: clippy, rustfmt | |
- name: Cargo Clippy Fix | |
if: env.LINT_MODE == 'fix' | |
run: cargo +nightly clippy --all --all-targets --all-features --fix --allow-staged --allow-dirty | |
- name: Cargo Fmt fix | |
if: env.LINT_MODE == 'fix' | |
run: cargo +nightly fmt --all | |
- name: Cargo Clippy Check | |
run: cargo +nightly clippy --all --all-targets --all-features | |
- name: Cargo Fmt Check | |
run: cargo +nightly fmt --check | |
- name: Commit and push if changed | |
if: env.LINT_MODE == 'fix' | |
uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |