Skip to content

Commit

Permalink
Add doctoc script and Makefile targets
Browse files Browse the repository at this point in the history
Signed-off-by: Furkat Gofurov <furkat.gofurov@suse.com>
  • Loading branch information
furkatgofurov7 committed Sep 1, 2023
1 parent 70f5f0d commit c8e14bb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,20 @@ test-e2e: $(GINKGO) $(HELM) $(CAPI_OPERATOR) kubectl ## Run the end-to-end tests
-e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) \
-e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER)

## --------------------------------------
## Documentation
## --------------------------------------

.PHONY: generate-doctoc
generate-doctoc:
TRACE=$(TRACE) ./hack/generate-doctoc.sh

.PHONY: verify-doctoc
verify-doctoc: generate-doctoc
@if !(git diff --quiet HEAD); then \
git diff; \
echo "doctoc is out of date, run make generate-doctoc"; exit 1; \
fi

## --------------------------------------
## Cleanup / Verification
Expand Down
31 changes: 31 additions & 0 deletions hack/generate-doctoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Copyright 2023 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi

if [[ -z "$(command -v doctoc)" ]]; then
echo "doctoc is not available on your system, skipping verification"
echo "Note: The doctoc module can be installed via npm (https://www.npmjs.com/package/doctoc)"
exit 0
fi

doctoc ./CONTRIBUTING.md

0 comments on commit c8e14bb

Please sign in to comment.