Skip to content
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
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
test:
name: Go and docs
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true

- name: Set up Terraform
uses: hashicorp/setup-terraform@v4
with:
terraform_version: "1.15.5"
terraform_wrapper: false

- name: Check Go formatting
run: |
files="$(gofmt -l cmd internal)"
if [ -n "$files" ]; then
echo "$files"
exit 1
fi

- name: Check Terraform examples
run: terraform fmt -check -recursive examples

- name: Test
run: go test -short -timeout=2m ./...

- name: Vet
run: go vet ./...

- name: Check generated docs
run: bash scripts/check-docs.sh
16 changes: 16 additions & 0 deletions scripts/check-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# CI drift gate: regenerate docs/ with scripts/generate-docs.sh (the same
# entry point `go generate ./...` uses) and fail if the committed docs differ.
set -euo pipefail

root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

bash "$root/scripts/generate-docs.sh"

cd "$root"
doc_status="$(git status --porcelain -- docs/index.md docs/resources docs/data-sources)"
if [ -n "$doc_status" ]; then
echo "$doc_status"
git diff -- docs/index.md docs/resources docs/data-sources
exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs drift check misses paths

Medium Severity

The generated-docs gate only runs git status on docs/index.md, docs/resources, and docs/data-sources. tfplugindocs can also write under docs/guides, docs/functions, and docs/ephemeral-resources, so new or changed files there would not fail CI despite the PR describing detection of any new generated docs.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9dad510. Configure here.

fi