Skip to content

Commit

Permalink
Use bash to support all required commands #5
Browse files Browse the repository at this point in the history
Shell on GitHub actions did not support the `exec` command. This enable the used of pre-commit in github actions.

With this a linting job can be configured as follows:
```
  lint:
    name: Linting
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source
        uses: actions/checkout@v2

      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.8'

      - name: Update python environment
        run: |
          pip install --upgrade pre-commit

      - name: Run all linters
        run: pre-commit run --all-files
```
  • Loading branch information
elmi82 authored Apr 1, 2021
2 parents 18a324a + dea9075 commit 77711cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions run-ktlint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
set -eu
IFS=$'\n\t'

Expand All @@ -10,7 +10,7 @@ SUCCESS_FILE="${CACHE}/download-finished-${VERSION}"
LOCKFILE="${CACHE}/pre-commit-ktlint-download.lock"

# make sure that lock file gets cleanup up in all cases
trap 'rm -f ${LOCKFILE}' EXIT
trap "rm -f ${LOCKFILE}" EXIT

mkdir -p "${CACHE}"
if [ ! -f "${SUCCESS_FILE}" ]
Expand Down

0 comments on commit 77711cd

Please sign in to comment.