name: Lint on: pull_request: branches: [ master ] jobs: lint: name: Markdown and Go runs-on: ubuntu-latest permissions: # Required: allow read access to the content for analysis. contents: read steps: - name: Check out code into the Go module directory uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Lint markdown uses: nosborn/github-action-markdown-cli@508d6cefd8f0cc99eab5d2d4685b1d5f470042c1 # v3.5.0 with: files: '.' config_file: ".markdownlint.json" - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: go.mod - name: Go formatting run: | if [ -z "$(gofmt -l .)" ]; then echo -e "All '*.go' files are properly formatted." else echo -e "Please run 'make go-lint' to fix. Some files need formatting:" gofmt -d -l . exit 1 fi - name: Read golangci-lint version id: lint-version run: | version=$(sed -n 's/^GOLANG_CI_LINTER_VERSION=//p' scripts/install-tools.sh) echo "version=${version}" >> $GITHUB_OUTPUT echo "golangci-lint version: ${version}" # https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#verify - name: Verify linter configuration and Lint go code uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: verify: true args: --timeout=30m version: ${{ steps.lint-version.outputs.version }} - name: Run file hygiene checks run: ./scripts/file-hygiene.sh check-go-version: name: Go version consistency runs-on: ubuntu-latest permissions: contents: read steps: - name: Check out code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Check Go version consistency across cloudbuild.yaml, go.mod and go.tool.mod run: ./scripts/go-version-consistency.sh