Feat/fix pipelines (#13) #1
This file contains hidden or 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 Pipeline | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request_target: | |
| types: [synchronize] | |
| workflow_dispatch: | |
| jobs: | |
| go-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Go environment | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: "1.24" | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s v2.1.6 | |
| - name: Install staticcheck | |
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
| - name: Run gofmt, golangci-lint, and staticcheck | |
| run: | | |
| chmod +x ./scripts/lint-go.sh | |
| ./scripts/lint-go.sh | |
| - name: Commit and push fixes | |
| run: | | |
| # Check if there are any changes after gofmt or golangci-lint | |
| git diff --exit-code || ( | |
| echo "There are changes, committing the fixes..." && | |
| git config user.name "github-actions" && | |
| git config user.email "github-actions@github.com" && | |
| git add . && | |
| git commit -m "Apply gofmt and golangci-lint fixes" && | |
| git push | |
| ) |