Merge pull request #186 from ccamel/dependabot/go_modules/google.gola… #280
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: Lint | |
on: | |
workflow_call: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: lint-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint-commits: | |
runs-on: ubuntu-22.04 | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check commits | |
uses: wagoid/commitlint-github-action@v6 | |
lint-markdown: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Lint regular markdown files | |
uses: avto-dev/[email protected] | |
with: | |
args: "**/*.md" | |
lint-yaml: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Lint yaml files | |
uses: ibiqlik/[email protected] | |
lint-go: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Find changed go files | |
id: changed-go-files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
**/*.go | |
go.mod | |
go.sum | |
- name: Setup Go environment | |
uses: actions/[email protected] | |
if: steps.changed-go-files.outputs.any_changed == 'true' | |
with: | |
go-version: "1.23" | |
cache: false | |
- name: Lint go code (golangci-lint) | |
uses: golangci/golangci-lint-action@v6 | |
if: steps.changed-go-files.outputs.any_changed == 'true' | |
with: | |
version: v1.61.0 | |
- name: Lint go code (gofumpt) | |
if: steps.changed-go-files.outputs.any_changed == 'true' | |
run: | | |
go install mvdan.cc/[email protected] | |
if [ "$(gofumpt -l .)" != "" ]; then | |
echo "❌ Code is not gofumpt!" | |
exit 1 | |
fi | |
echo "✅ Code is gofumpt!" | |
lint-proto: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Find changed proto files | |
id: changed-proto-files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
internal/**/*.proto | |
- name: Lint proto files | |
if: steps.changed-proto-files.outputs.any_changed == 'true' | |
run: | | |
make lint-proto |