51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
name: "golangci-lint"
|
|
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'website/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
name: "Run Linter"
|
|
runs-on: ${{ fromJSON(vars.RUNNER) }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: '0'
|
|
- name: Determine Go version
|
|
id: get-go-version
|
|
# We use .go-version as our source of truth for current Go
|
|
# version, because "goenv" can react to it automatically.
|
|
run: |
|
|
echo "Building with Go $(cat .go-version)"
|
|
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
|
with:
|
|
go-version: "${{ steps.get-go-version.outputs.go-version }}"
|
|
cache: false
|
|
- name: Determine Go cache paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
|
|
- name: Set up Go modules cache
|
|
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.3
|
|
with:
|
|
path: |
|
|
${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: go-mod-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
go-mod
|
|
- name: Install Dependencies
|
|
# if we really need to we can update this to run `make tools`
|
|
# later but its just not necessary to only run linters
|
|
run: |
|
|
make golangci-lint
|
|
- name: Running Linters
|
|
run: |
|
|
LINT_DIFF_BRANCH="origin/${GITHUB_BASE_REF}" make lint-diff
|