Skip to content

Commit

Permalink
Merge pull request #270 from boozook/ci/fmt
Browse files Browse the repository at this point in the history
CI: improve format test for PRs
  • Loading branch information
boozook authored Apr 4, 2024
2 parents 80ba098 + e98d01d commit c5aad1e
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,29 @@ jobs:
defaults:
run:
shell: bash

runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v4

# - name: Check
# if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
# uses: clechasseur/[email protected]
# # with:
# # toolchain: nightly

- name: Check
# if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
run: cargo fmt -- --check
id: check
continue-on-error: true
run: >-
cargo fmt --all -- --check ||
(echo "::error::Rust format error." && exit 1)
- name: Format
id: format
if: steps.check.outcome == 'failure' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
run: cargo fmt --all

- name: Suggest Changes
if: success() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
# https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
uses: parkerbxyz/suggest-changes@v1
# with: comment: Rustfmt suggested the formatting changes.

0 comments on commit c5aad1e

Please sign in to comment.