Files
Packer-Cn/.github/workflows/go-validate.yml
Wilken Rivera 50a356529a Update Go checks to run on pull_requests (#12166)
Currently go-test and go-validate only run for users who have push
access to the Packer repo. We want to ensure tests and validation run
for all opened pull requests including public forks.
2022-12-16 11:35:41 -05:00

58 lines
1.2 KiB
YAML

#
# This GitHub action runs basic linting checks for Packer.
#
name: "Go Validate"
on:
push:
branches:
- 'main'
pull_request:
permissions:
contents: read
jobs:
check-mod-tidy:
runs-on: ubuntu-latest
name: Go Mod Tidy
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18'
- run: go mod tidy
check-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: '1.18'
- run: echo "$GITHUB_SHA"
- run: git fetch --all
- run: echo $(git merge-base origin/main $GITHUB_SHA)
- run: make ci-lint
check-fmt:
runs-on: ubuntu-latest
name: Fmt check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18'
- run: make fmt-check
check-generate:
runs-on: ubuntu-latest
name: Generate check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18'
- run: make generate-check