Skip to content

Commit 9fe5134

Browse files
committed
automatically set Git hooks in Makefile
1 parent a682e35 commit 9fe5134

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.git-hooks/pre-push

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e -o pipefail
4+
5+
if [[ "$CI" != "" ]]; then
6+
exit
7+
fi
8+
9+
set +x
10+
11+
make test
12+
make lint

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
/man/actionlint.1.html
1313
/playground-dist
1414
/actionlint-workflow-ast
15-
# IntelliJ IDE Folder
16-
.idea/
15+
/.git-hooks/.timestamp

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SRCS := $(filter-out %_test.go, $(wildcard *.go cmd/actionlint/*.go)) go.mod go.sum
1+
SRCS := $(filter-out %_test.go, $(wildcard *.go cmd/actionlint/*.go)) go.mod go.sum .git-hooks/.timestamp
22
TESTS := $(filter %_test.go, $(wildcard *.go))
33
TOOL := $(filter %_test.go, $(wildcard scripts/*/*.go))
44
TESTDATA := $(wildcard \
@@ -15,7 +15,7 @@ GO_GEN_SRCS := scripts/generate-popular-actions/main.go \
1515
scripts/generate-webhook-events/main.go \
1616
scripts/generate-availability/main.go
1717

18-
all: clean build test
18+
all: build test lint
1919

2020
.testtimestamp: $(TESTS) $(SRCS) $(TESTDATA) $(TOOL)
2121
go test ./...
@@ -70,4 +70,8 @@ c clean:
7070
rm -f ./actionlint ./.testtimestamp ./.staticchecktimestamp ./actionlint_fuzz-fuzz.zip ./man/actionlint.1 ./man/actionlint.1.html ./actionlint-workflow-ast
7171
rm -rf ./corpus ./crashers
7272

73+
.git-hooks/.timestamp: .git-hooks/pre-push
74+
[ -z "${CI}" ] && git config core.hooksPath .git-hooks || true
75+
touch .git-hooks/.timestamp
76+
7377
.PHONY: all test clean build lint fuzz man bench b t c l

0 commit comments

Comments
 (0)