[#1118] .forgejo: Add pre-commit action
All checks were successful
Build / Build Components (1.21) (pull_request) Successful in 5m45s
DCO action / DCO (pull_request) Successful in 5m37s
Build / Build Components (1.22) (pull_request) Successful in 6m11s
Vulncheck / Vulncheck (pull_request) Successful in 13m29s
Tests and linters / gopls check (pull_request) Successful in 16m49s
Tests and linters / Staticcheck (pull_request) Successful in 17m30s
Pre-commit hooks / Pre-commit (pull_request) Successful in 19m15s
Tests and linters / Lint (pull_request) Successful in 19m12s
Tests and linters / Tests with -race (pull_request) Successful in 19m38s
Tests and linters / Tests (1.22) (pull_request) Successful in 19m54s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m22s

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-05-06 08:58:55 +03:00
parent f708b8d1e9
commit 82437f7d14

View file

@ -0,0 +1,25 @@
name: Pre-commit hooks
on: [pull_request]
jobs:
precommit:
name: Pre-commit
env:
# Skip pre-commit hooks which are executed by other actions.
SKIP: make-lint,go-staticcheck-repo-mod,go-unit-tests,gofumpt
runs-on: ubuntu-22.04
# If we use actions/setup-python from either Github or Gitea,
# the line above fails with a cryptic error about not being able to found python.
# So install everything manually.
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Set up Python
run: |
apt update
apt install -y pre-commit
- name: Run pre-commit
run: pre-commit run --color=always --hook-stage manual --all-files