cicd: Require commit messages are tagged
This commit is contained in:
parent
54d6855b3d
commit
9ca94756e5
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
commitmsg = ""
|
||||
|
||||
with open('.git/COMMIT_EDITMSG', mode='r') as f:
|
||||
commitmsg = f.readline().strip()
|
||||
|
||||
print("Commit message is: " + commitmsg)
|
||||
|
||||
ALLOWED_COMMIT_TYPES = [
|
||||
"cicd",
|
||||
"typo",
|
||||
"fmt",
|
||||
"doc",
|
||||
"bugfix",
|
||||
"security",
|
||||
"feature",
|
||||
]
|
||||
|
||||
for allowedType in ALLOWED_COMMIT_TYPES:
|
||||
if commitmsg.startswith(allowedType + ":"):
|
||||
print("Allowing commit type: ", allowedType)
|
||||
sys.exit(0)
|
||||
|
||||
print("Commit message should start with commit type. One of: ", ", ".join(ALLOWED_COMMIT_TYPES))
|
||||
sys.exit(1)
|
||||
5
Makefile
5
Makefile
|
|
@ -21,6 +21,9 @@ daemon-unittests:
|
|||
mkdir -p reports
|
||||
go test ./... -coverprofile reports/unittests.out
|
||||
go tool cover -html=reports/unittests.out -o reports/unittests.html
|
||||
|
||||
githooks:
|
||||
cp -v .githooks/* .git/hooks/
|
||||
|
||||
go-tools:
|
||||
go install "github.com/bufbuild/buf/cmd/buf"
|
||||
|
|
@ -31,7 +34,7 @@ go-tools:
|
|||
go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
|
||||
go install "google.golang.org/protobuf/cmd/protoc-gen-go"
|
||||
|
||||
grpc: go-tools
|
||||
grpc: githooks go-tools
|
||||
buf generate
|
||||
|
||||
podman-image:
|
||||
|
|
|
|||
Loading…
Reference in New Issue