ci(go): add GitHub Actions build workflow; drop local pre-commit hooks#47
ci(go): add GitHub Actions build workflow; drop local pre-commit hooks#47
Conversation
…nd JSON/req fixers - remove hooks: check-json, pretty-format-json (excluded cspell.json), requirements-txt-fixer - drop gitleaks and hadolint hooks - keep core whitespace fixers and strict yamllint; cspell CLI remains
- Add .github/workflows/go.yml to build on PRs and pushes to main. - Load project settings from .project-settings.env (GO_VERSION, GCI_PREFIX default github.com/hyp3rd/starter, GOLANGCI_LINT_VERSION, PROTO_ENABLED). - Set up Go via actions/setup-go@v6.1.0; cache modules; run `go mod download`, `go mod tidy` (with diff check), `go mod verify`, and `go build -v ./...`. - Remove local `go-verify` and `gci` hooks from `.pre-commit-ci-config.yaml` to simplify local tooling. Why: enforce module hygiene and builds in CI while reducing reliance on local hooks.
There was a problem hiding this comment.
Pull request overview
This PR adds a new GitHub Actions workflow for Go builds and module verification while removing several pre-commit hooks to consolidate CI checks in GitHub Actions.
Changes:
- Adds
.github/workflows/go.ymlto run Go module verification and build on PRs and main branch pushes - Removes multiple pre-commit hooks from
.pre-commit-ci-config.yamlincluding local Go hooks (go-verify, gci) and several other hooks
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/go.yml |
New workflow that loads project settings, sets up Go, caches modules, runs go mod download/tidy/verify, and builds the project |
.pre-commit-ci-config.yaml |
Removes local go-verify and gci hooks, plus json, gitleaks, hadolint, and requirements hooks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "proto_enabled=${PROTO_ENABLED:-true}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6.1.0 |
There was a problem hiding this comment.
The version specifier 'v6.1.0' for actions/setup-go is inconsistent with other workflows in the repository, which all use 'v6' without a patch version. For consistency and maintainability, this should use the same version format as the other workflows (codeql.yml, lint.yml, pre-commit.yml, proto.yml, security.yml, and test.yml all use 'actions/setup-go@v6').
| uses: actions/setup-go@v6.1.0 | |
| uses: actions/setup-go@v6 |
| source .project-settings.env | ||
| set +a | ||
| echo "go_version=${GO_VERSION}" >> "$GITHUB_OUTPUT" | ||
| echo "gci_prefix=${GCI_PREFIX:-github.com/hyp3rd/starter}" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
The default value for GCI_PREFIX is 'github.com/hyp3rd/starter' but the actual value in .project-settings.env is 'github.com/hyp3rd/sectools'. This default appears to be incorrect and should match the actual project. The same inconsistency exists in lint.yml. Consider updating the default to match the actual project value.
| echo "gci_prefix=${GCI_PREFIX:-github.com/hyp3rd/starter}" >> "$GITHUB_OUTPUT" | |
| echo "gci_prefix=${GCI_PREFIX:-github.com/hyp3rd/sectools}" >> "$GITHUB_OUTPUT" |
go mod download,go mod tidy(with diff check),go mod verify, andgo build -v ./....go-verifyandgcihooks from.pre-commit-ci-config.yamlto simplify local tooling.Why: enforce module hygiene and builds in CI while reducing reliance on local hooks.