From 5c3f5cad9f5ad30eca6dca66b396a1bfac4c889e Mon Sep 17 00:00:00 2001 From: aleksana Date: Wed, 31 Jul 2024 22:16:55 +0800 Subject: [PATCH] ci: minor fix to treefmt check --- .github/workflows/treefmt.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/treefmt.yml b/.github/workflows/treefmt.yml index 0aa84f681..0a5ef7c6d 100644 --- a/.github/workflows/treefmt.yml +++ b/.github/workflows/treefmt.yml @@ -8,18 +8,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: cachix/install-nix-action@v22 - - uses: actions/checkout@v3 - - id: files + - uses: actions/checkout@v4 + - id: changed-files uses: tj-actions/changed-files@v44 - name: Run treefmt run: nix fmt - name: Check diff + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | unformatted_touched=() unformatted_untouched=() while IFS= read -r unformatted_file; do matched= - for changed_file in ${{ steps.files.outputs.all }}; do + for changed_file in ${ALL_CHANGED_FILES}; do if [[ "$changed_file" == "$unformatted_file" ]]; then unformatted_touched+=("$unformatted_file") matched=1 @@ -36,6 +38,8 @@ jobs: printf '%s\n' "${unformatted_untouched[@]}" fi + echo # blank line + if (( ${#unformatted_touched[@]} )); then echo "These files are created/edited but not formatted:" printf '%s\n' "${unformatted_touched[@]}"