Merge pull request #24 from e-breuninger/dependabot/go_modules/golang… #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pre-commit | |
on: | |
push: | |
branches: ["*"] | |
jobs: | |
pre-commit: | |
permissions: read-all | |
runs-on: ubuntu-latest | |
container: | |
image: alpine:3.17 | |
env: | |
GOPATH: ~/.cache/go | |
APK_CACHE_DIR: ~/.cache/apk | |
steps: | |
- name: Install job dependencies | |
run: apk add tar git | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache | |
key: pre-commit | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Ensure cache directories | |
run: | | |
mkdir -p $APK_CACHE_DIR | |
mkdir -p $GOPATH | |
mkdir -p ~/.cache/pip | |
mkdir -p ~/.cache/pre-commit | |
- name: Install job dependencies | |
run: | | |
export GOPATH=$(realpath $GOPATH) | |
apk update --cache-dir $APK_CACHE_DIR | |
apk add --cache-dir $APK_CACHE_DIR go python3-dev py3-pip gcc musl-dev | |
go install github.com/kisielk/[email protected] | |
go install honnef.co/go/tools/cmd/[email protected] | |
pip install pre-commit | |
- name: Run pre-commit-hooks | |
run: | | |
git config --global --add safe.directory $PWD | |
export GOPATH=$(realpath $GOPATH) | |
export PATH=/usr/local/go/bin:$GOPATH/bin:$PATH | |
pre-commit run --all-files --color=always --show-diff-on-failure |