feat: compare event sha to HEAD #53
Workflow file for this run
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: Go | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- '**/**.go' | |
- 'go.mod' | |
- 'go.sum' | |
- '**/_testdata/**' | |
- '.github/workflows/go.yml' | |
pull_request: | |
branches: ["main"] | |
paths: | |
- '**/**.go' | |
- 'go.mod' | |
- 'go.sum' | |
- '**/_testdata/**' | |
- '.github/workflows/go.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Build | |
run: go build -v ./... | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Format | |
run: go fmt ./... | |
lint: | |
# Only lint on PRs; it's not as useful on pushes to main | |
if: github.event_name == 'pull_request' | |
# Disable Go 1.11 modules when running per: | |
# https://github.com/golangci/golangci-lint/issues/395#issuecomment-922153131 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go for golangci-lint | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache: false | |
env: | |
GO111MODULE: "off" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
only-new-issues: true | |
env: | |
GO111MODULE: "off" | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Test | |
run: go test -v ./... |