diff --git a/.github/workflows/pre-merge.yaml b/.github/workflows/pre-merge.yaml index 75c69cc..168c41e 100644 --- a/.github/workflows/pre-merge.yaml +++ b/.github/workflows/pre-merge.yaml @@ -16,19 +16,14 @@ jobs: is-latest: false is-stable: false - go-generate: - runs-on: ubuntu-26.04 - steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Set up Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version-file: 'go.mod' - - name: Verify generated mocks are up to date - run: | - go generate ./... - git diff --exit-code + go-generated: + # On a Renovate branch, pushes the regenerated mocks itself. + uses: scality/workflows/.github/workflows/go-generated.yaml@1c3bb83b992d0a512c08755606ee6439b26c463b # v2.13.0 + secrets: + ACTIONS_APP_PRIVATE_KEY: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }} + with: + push-to-renovate-branches: true + actions-app-id: ${{ vars.ACTIONS_APP_ID }} lint: runs-on: ubuntu-26.04 @@ -72,7 +67,7 @@ jobs: if: always() needs: - build - - go-generate + - go-generated - lint - test - test-e2e diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e0a9e3..b2019fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,9 @@ owns its responsibility: errors.CausedBy(rawErr))` so `errors.Is` keeps matching the category. - **Tests**: Ginkgo + Gomega. Mocks for the `service` ports are generated by mockery (`go generate ./...`) and committed; never edit them by hand. CI - fails if the committed mocks are stale. + runs `go mod tidy` and `go generate ./...` and fails if the result differs + from what is committed. On `renovate/*` branches, it pushes the regenerated + code itself. - **Linting & formatting**: `golangci-lint run` must pass; format with `golangci-lint fmt`.