Skip to content

Add JSON schema checking functionality for DRep and Gov action metadata #719

Add JSON schema checking functionality for DRep and Gov action metadata

Add JSON schema checking functionality for DRep and Gov action metadata #719

name: Check cabal-gild format
on:
merge_group:
pull_request:
jobs:
check-cabal-gild:
runs-on: ubuntu-latest
env:
CABAL_GILD_VERSION: "1.3.1.2"
steps:
- name: Download cabal-gild
run: |
cabal_gild_path="$(mktemp -d)"
version="${{env.CABAL_GILD_VERSION}}"
curl -sL \
"https://github.com/tfausak/cabal-gild/releases/download/$version/cabal-gild-$version-linux-x64.tar.gz" \
| tar -C "$cabal_gild_path" -xz
echo "PATH=$cabal_gild_path:$PATH" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Run cabal-gild over all modified files
run: |
rc="0"
echo "cabal-gild version: ${{env.CABAL_GILD_VERSION}}"
for file in $(git ls-files "*.cabal")
do
echo "cabal-gild --mode=check --input=$file"
if ! cabal-gild --mode=check --input="$file"
then
cabal-gild --mode=format --io="$file"
echo "💣 $file is badly formatted. Fix it with:"
echo "cabal-gild --mode=format --io=$file"
echo -e
echo "Diff for $file:"
git diff "$file"
echo -e
rc="1"
fi
done
exit $rc