23 lines
773 B
YAML
23 lines
773 B
YAML
|
name: autofmt_push
|
||
|
on: [push]
|
||
|
jobs:
|
||
|
build:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
- uses: actions-rs/toolchain@v1
|
||
|
with:
|
||
|
profile: minimal
|
||
|
toolchain: nightly
|
||
|
components: rustfmt
|
||
|
- run: cargo fmt -- --check
|
||
|
- name: If needed, commit cargo fmt changes
|
||
|
if: failure()
|
||
|
run: |
|
||
|
cargo fmt
|
||
|
git config --global user.name github-actions
|
||
|
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
|
||
|
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||
|
git commit -am "fixup! Format Rust code with rustfmt"
|
||
|
git push --force origin HEAD:$GITHUB_REF
|