Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "API Docs" GitHub Action to check if docs are up to date #324

Merged
merged 8 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/api-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: API Docs
on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
check-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
- name: gen-crd-api-reference-docs
run: make api-docs
- name: Check if docs are up to date
# This check must fail if there are diffs.
run: git diff --exit-code ./docs/api.md
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Before sending your pull requests, make sure you do the following:
- Read this contributing guide.
- Read the [Code of Conduct][code-conduct-link].
- Run the [tests](#running-tests).
- Run `make prepare-for-pr`. For details, see [Prepare Code for PR](#prepare-code-for-pr) section.

## How to become a contributor

Expand Down Expand Up @@ -49,6 +50,19 @@ For a full set of instructions to run tests, follow the testing & debugging sect
make clean && make dev && make test
```

### Prepare Code for PR

Before submitting a PR, run the following `make` target.

```shell
make prepare-for-pr
```

This will perform following checks:
- Examine Go source code and report suspicious constructs.
- Format Go source code.
- Update API docs if applicable.

## Security

For instructions on reporting security issues and bugs, please see [security][security-link] guide.
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=chart/orkestra/crds

# Prepare code for PR
prepare-for-pr: vet fmt api-docs

# Generate API reference documentation
api-docs: gen-crd-api-reference-docs
$(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api.md
Expand Down