-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (59 loc) · 1.68 KB
/
review.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: review
on:
pull_request:
branches: [ main ]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Install Dependency
run: sudo apt update && sudo apt install -y gcc
build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19.1
uses: actions/setup-go@v3
with:
go-version: 1.19.1
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: go mod download
run: go mod download
- name: test
run: go test ./...
formatting:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19.1
uses: actions/setup-go@v3
with:
go-version: 1.19.1
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }} # PRを作ったbranch名
- name: go fmt
run: go fmt ./...
- name: commit & push when file is changed
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add -A
git commit -m "Formatting by github actions" && git push ${REPO} HEAD:${{ github.event.pull_request.head.ref }} || true
glangci_lint:
needs: formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Code Review by golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--config=.golangci.yml"
filter_mode: nofilter
cache: false
level: warning
reporter: github-pr-review