Skip to content

add support for script based drep on update certificate #233

add support for script based drep on update certificate

add support for script based drep on update certificate #233

name: Check Haskell formatting
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-formatting:
runs-on: ubuntu-latest
env:
FOURMOLU_VERSION: "0.16.2.0"
STYLISH_HASKELL_VERSION: "0.14.6.0"
steps:
- name: Download Fourmolu
run: |
fourmolu_path="$(mktemp -d)"
version="${{env.FOURMOLU_VERSION}}"
curl -sL \
"https://github.com/fourmolu/fourmolu/releases/download/v$version/fourmolu-$version-linux-x86_64" > "$fourmolu_path/fourmolu"
echo "PATH=$fourmolu_path:$PATH" >> "$GITHUB_ENV"
chmod u+rwx "$fourmolu_path/fourmolu"
- name: Download stylish-haskell
run: |
stylish_haskell_path="$(mktemp -d)"
version="${{ env.STYLISH_HASKELL_VERSION }}"
curl -sL \
"https://github.com/haskell/stylish-haskell/releases/download/v$version/stylish-haskell-v$version-linux-x86_64.tar.gz" \
| tar -C "$stylish_haskell_path" -xz
echo "PATH=$stylish_haskell_path/stylish-haskell-v$version-linux-x86_64:$PATH" >> "$GITHUB_ENV"
- uses: actions/checkout@v3
- name: Run formatting over all Haskell files (always succeeds)
run: |
git add .
git stash
for x in $(git ls-tree --full-tree --name-only -r HEAD); do
if [ "${x##*.}" == "hs" ]; then
if grep -qE '^#' "$x"; then
echo "$x contains CPP. Skipping."
else
"$(git rev-parse --show-toplevel)/scripts/devshell/prettify" "$x"
fi
fi
done
git --no-pager diff
- name: Run formatting 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); do
if [ "${x##*.}" == "hs" ]; then
if grep -qE '^#' "$x"; then
echo "$x contains CPP. Skipping."
else
"$(git rev-parse --show-toplevel)/scripts/devshell/prettify" "$x"
fi
fi
done
git --no-pager diff --exit-code