Skip to content

Commit

Permalink
Apply suggestions by @smelc
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Hurlin <[email protected]>
  • Loading branch information
palas and smelc committed Jul 4, 2024
1 parent 8792c16 commit b86586c
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions .github/workflows/check-cabal-gild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/<target branch name> (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"

Expand All @@ -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

0 comments on commit b86586c

Please sign in to comment.