Fix/update permission #22
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - "vhs/**" | |
| pull_request: | |
| branches: [main, develop] | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - "vhs/**" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Add Go bin to PATH | |
| run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Install golangci-lint | |
| run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 | |
| - name: Run linters | |
| run: make lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Run unit tests | |
| run: make test | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Build | |
| run: make build | |
| format: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Add Go bin to PATH | |
| run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Install goimports | |
| run: go install golang.org/x/tools/cmd/goimports@latest | |
| - name: Check formatting | |
| run: | | |
| make fmt | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "Code is not formatted. Please run 'make fmt'" | |
| git diff | |
| exit 1 | |
| fi | |
| mod-tidy: | |
| name: Go Mod Tidy Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Check go mod tidy | |
| run: | | |
| go mod tidy | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "go.mod or go.sum is not tidy. Please run 'go mod tidy'" | |
| git diff | |
| exit 1 | |
| fi | |
| vuln-scan: | |
| name: Vulnerability Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Add Go bin to PATH | |
| run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Install govulncheck | |
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
| - name: Run govulncheck | |
| run: govulncheck ./... | |
| changelog-guard: | |
| name: Changelog Guard | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check for CHANGELOG.md changes | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --jq '.[].filename') | |
| if echo "$CHANGED_FILES" | grep -q '^CHANGELOG.md$'; then | |
| echo "::error::CHANGELOG.md should not be modified manually. It is auto-generated by git-cliff at release time." | |
| echo "" | |
| echo "Please revert your changes to CHANGELOG.md." | |
| echo "The changelog is generated automatically from conventional commit messages (feat:, fix:, chore:, etc.)." | |
| exit 1 | |
| fi | |
| echo "CHANGELOG.md not modified - all good." | |
| ci-success: | |
| name: All CI Checks Passed | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: [lint, test, build, format, mod-tidy, vuln-scan, changelog-guard] | |
| steps: | |
| - name: Check results | |
| run: | | |
| for result in "${{ needs.lint.result }}" "${{ needs.test.result }}" "${{ needs.build.result }}" "${{ needs.format.result }}" "${{ needs.mod-tidy.result }}" "${{ needs.vuln-scan.result }}"; do | |
| if [ "$result" != "success" ]; then | |
| echo "One or more CI checks failed" | |
| exit 1 | |
| fi | |
| done | |
| if [ "${{ needs.changelog-guard.result }}" != "success" ] && [ "${{ needs.changelog-guard.result }}" != "skipped" ]; then | |
| echo "Changelog guard failed" | |
| exit 1 | |
| fi | |
| echo "All CI checks passed successfully!" |