fix(github): lead with the database's operators on command-rejection comments #5370
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: golangci-lint | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| branches: | |
| - master | |
| - main | |
| pull_request: | |
| # Required status checks must also report on the merge queue, or the queue | |
| # waits forever. Inert until a repo admin enables the merge queue. | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| # See test.yaml for the rationale of this docs-only skip pattern. | |
| changes: | |
| name: "Detect changes" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| code: ${{ steps.out.outputs.code }} | |
| steps: | |
| - name: "Detect non-docs changes" | |
| if: github.event_name == 'pull_request' | |
| id: filter | |
| continue-on-error: true | |
| uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 # dorny/paths-filter@v3.0.3 | |
| with: | |
| filters: | | |
| code: | |
| - '**' | |
| - '!**/*.md' | |
| - '!docs/**' | |
| - name: "Resolve code-change flag" | |
| id: out | |
| shell: bash | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| FILTER_OUTCOME: ${{ steps.filter.outcome }} | |
| FILTER_CODE: ${{ steps.filter.outputs.code }} | |
| run: | | |
| if [ "$EVENT_NAME" != "pull_request" ]; then | |
| echo "code=true" >> "$GITHUB_OUTPUT" | |
| elif [ "$FILTER_OUTCOME" != "success" ]; then | |
| echo "::warning::paths-filter failed; running CI instead of skipping" | |
| echo "code=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "code=$FILTER_CODE" >> "$GITHUB_OUTPUT" | |
| fi | |
| golangci: | |
| name: lint | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - name: default | |
| args: "" | |
| - name: integration | |
| args: --build-tags=integration | |
| - name: e2e | |
| args: --build-tags=e2e ./e2e/... | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # actions/checkout@v6 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # actions/setup-go@v6.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: "Restore Go cache" | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} | |
| restore-keys: go-${{ runner.os }}- | |
| - name: golangci-lint (${{ matrix.name }}) | |
| uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # ratchet:golangci/golangci-lint-action@v9.0.0 | |
| with: | |
| version: v2.11.4 | |
| args: ${{ matrix.args }} | |
| - name: webhookheaders analyzer | |
| if: matrix.name == 'default' | |
| run: make check-webhookheaders | |
| # Stable rollup for the lint matrix so a single check name can gate a merge, | |
| # mirroring the E2E/LocalScale/K8s rollups in test.yaml. The golangci matrix | |
| # check names (`lint (default)`, `lint (integration, …)`, `lint (e2e, …)`) | |
| # change with the matrix, so require this `Lint` check instead. | |
| lint-rollup: | |
| name: "Lint" | |
| needs: [changes, golangci] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - shell: bash | |
| env: | |
| CHANGES_RESULT: ${{ needs.changes.result }} | |
| CHANGES_CODE: ${{ needs.changes.outputs.code }} | |
| GOLANGCI_RESULT: ${{ needs.golangci.result }} | |
| run: | | |
| set -euo pipefail | |
| if [ "$CHANGES_RESULT" != "success" ]; then | |
| echo "::error::changes job failed" | |
| exit 1 | |
| fi | |
| if [ "$CHANGES_CODE" != "true" ]; then | |
| echo "Docs-only PR; lint intentionally skipped." | |
| exit 0 | |
| fi | |
| if [ "$GOLANGCI_RESULT" != "success" ]; then | |
| echo "::error::golangci result=$GOLANGCI_RESULT" | |
| exit 1 | |
| fi |