From 252755acc45745860d20a294bcb11534555f5ab8 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Thu, 4 Jul 2024 17:18:01 +0200 Subject: [PATCH] Apply suggestions by @smelc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Hurlin --- .github/workflows/check-cabal-gild.yml | 38 ++++++++++---------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check-cabal-gild.yml b/.github/workflows/check-cabal-gild.yml index 9e8d24d7a9..3acfff8cd0 100644 --- a/.github/workflows/check-cabal-gild.yml +++ b/.github/workflows/check-cabal-gild.yml @@ -4,27 +4,10 @@ on: merge_group: pull_request: -# When pushing branches (and/or updating PRs), we do want to cancel previous -# build runs. We assume they are stale now; and do not want to spend CI time and -# resources on continuing to continue those runs. This is what the concurrency.group -# value lets us express. When using merge queues, we now have to consider -# - runs triggers by commits per pull-request -# we want to cancel any previous run. So they should all get the same group (per PR) -# - runs refs/heads/gh-readonly-queue/ (they should all get their -# unique git ref, we don't want to cancel any of the ones in the queue) -# - if it's neither, we fall back to the run_id (this is a unique number for each -# workflow run; it does not change if you "rerun" a job) -concurrency: - group: ${{ github.workflow }}-${{ github.event.type }}-${{ startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.ref || github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - jobs: check-cabal-gild: runs-on: ubuntu-latest - strategy: - fail-fast: false - env: CARDANO_GUILD_VERSION: "1.3.1.2" @@ -39,15 +22,22 @@ jobs: echo "PATH=$cardano_gild_path:$PATH" >> "$GITHUB_ENV" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run cardano-gild over all modified files run: | - git add . - git stash - git fetch origin ${{ github.base_ref }} --unshallow - for x in $(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}..HEAD "*.cabal" | tr '\n' ' '); do - cabal-gild -i "$x" -o "$x" + rc="0" + + for file in $(git ls-files "*.cabal") + do + echo "cabal-gild --mode=check --input=$file" + if ! cabal-gild --mode=check --input="$file" + then + echo "💣 $file is badly formatted. Fix it with:" + echo "cabal-gild --mode=format --io=$file" + rc="1" + fi done - git --no-pager diff --exit-code + + exit $rc