fix: fix labsdk bugs (#320) #125
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 Lint | |
# Trigger the workflow on pull requests and direct pushes to any branch | |
on: | |
push: | |
paths: | |
- '**.go' | |
pull_request: | |
types: [ opened, synchronize ] | |
paths: | |
- '**.go' | |
jobs: | |
lint: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
steps: | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.21' | |
- name: Clone the code | |
uses: actions/checkout@v4 | |
- name: Cache go dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Generate necessary files | |
run: make generate | |
shell: bash | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest # Always uses the latest patch version. | |
only-new-issues: true # Show only new issues if it's a pull request | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: --timeout=5m | |
- name: Report failure | |
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'create-issue' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: 🐛 Lint failed for ${{ github.sha }} | |
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
labels: bug |