mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
ci: Remove auto format code when formatting step fails (#2476)
This commit is contained in:
21
.github/workflows/CI-pr.yml
vendored
21
.github/workflows/CI-pr.yml
vendored
@ -43,36 +43,17 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.ref }}
|
|
||||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
|
|
||||||
- name: Check formatting for forked pull requests
|
- name: Check formatting
|
||||||
if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cargo +nightly fmt --all --check
|
run: cargo +nightly fmt --all --check
|
||||||
|
|
||||||
- name: Run formatter
|
|
||||||
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cargo +nightly fmt --all
|
|
||||||
if ! git diff --exit-code --quiet -- crates; then
|
|
||||||
echo "::notice::Formatting check failed"
|
|
||||||
git config --local user.name 'github-actions[bot]'
|
|
||||||
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
|
||||||
git add crates
|
|
||||||
git commit --message 'chore: run formatter'
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
|
|
||||||
check-msrv:
|
check-msrv:
|
||||||
name: Check compilation on MSRV toolchain
|
name: Check compilation on MSRV toolchain
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|||||||
Reference in New Issue
Block a user