From f36e65b15d9bce54387e7547a148c5518dc4b70e Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Tue, 10 Oct 2023 22:17:24 -0600 Subject: [PATCH] #6614 Add inclusive source scanning --- .github/workflows/woke.yml | 22 ++++++++++++++++++++++ .wokeignore | 3 +++ DEVELOPMENT.md | 5 +++++ Makefile | 11 +++++++++++ 4 files changed, 41 insertions(+) create mode 100644 .github/workflows/woke.yml create mode 100644 .wokeignore diff --git a/.github/workflows/woke.yml b/.github/workflows/woke.yml new file mode 100644 index 00000000000..53fe0cc3123 --- /dev/null +++ b/.github/workflows/woke.yml @@ -0,0 +1,22 @@ +name: 'woke' +on: + - pull_request +jobs: + woke: + name: 'woke' + runs-on: ubuntu-latest + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + + - uses: jitterbit/get-changed-files@v1 + id: files + + - name: 'woke' + uses: get-woke/woke-action@v0 + with: + # Cause the check to fail on any broke rules + fail-on-error: true + # See https://github.com/marketplace/actions/get-all-changed-files + # for more options + woke-args: ${{ steps.files.outputs.added_modified }} diff --git a/.wokeignore b/.wokeignore new file mode 100644 index 00000000000..6a24c92374b --- /dev/null +++ b/.wokeignore @@ -0,0 +1,3 @@ +go.mod +go.sum +vendor diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 0d9a455fd9d..d56f6303871 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -95,6 +95,11 @@ You must install these tools: > **Note** Linter findings are dependent on your installed Go version. Match the version in [`go.mod`](go.mod) to match the findings in your PR. +1. (Optional) + [`woke`](https://docs.getwoke.tech/installation/) is executed for every pull + request. To ensure your work does not contain offensive language, you may + want to install and run this tool locally. + ### Configure environment To [build, deploy and run your Tekton Objects with `ko`](#install-pipeline), you'll need to set these environment variables: diff --git a/Makefile b/Makefile index bd07b8df0d5..38d90b0174a 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,10 @@ TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \ '{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \ $(PKGS)) BIN = $(CURDIR)/.bin +WOKE ?= go run -modfile go.mod github.com/get-woke/woke GOLANGCI_VERSION = v1.52.2 +WOKE_VERSION = v0.19.0 GO = go TIMEOUT_UNIT = 5m @@ -185,6 +187,14 @@ goimports: | $(GOIMPORTS) ; $(info $(M) running goimports…) ## Run goimports fmt: ; $(info $(M) running gofmt…) @ ## Run gofmt on all source files $Q $(GO) fmt $(PKGS) +WOKE = $(BIN)/woke +$(BIN)/woke: ; $(info $(M) getting woke $(WOKE_VERSION)) + cd tools; GOBIN=$(BIN) go install github.com/get-woke/woke@$(WOKE_VERSION) + +.PHONY: woke +woke: | $(WOKE) ; $(info $(M) running woke...) @ ## Run woke + $Q $(WOKE) -c https://github.com/canonical/Inclusive-naming/raw/main/config.yml + # Misc .PHONY: clean @@ -202,3 +212,4 @@ help: version: @echo $(VERSION) +