Skip to content

ci: fail Lint gen on newly created files#504

Merged
zedkipp merged 1 commit intomainfrom
ci/lint-gen-detect-new-files
Apr 24, 2026
Merged

ci: fail Lint gen on newly created files#504
zedkipp merged 1 commit intomainfrom
ci/lint-gen-detect-new-files

Conversation

@zedkipp
Copy link
Copy Markdown
Contributor

@zedkipp zedkipp commented Apr 23, 2026

The "Lint gen" step runs make gen and then git diff --exit-code. That
check only inspects tracked files, so when make gen produces a brand
new Markdown doc (e.g. for a new resource or data source added via
terraform-plugin-docs), the generated file stays untracked and CI
passes while the author's local docs/ is the only place the file
exists.

Reproducing on a clean main:

$ echo "## new" > docs/resources/brand-new-resource.md
$ git diff --exit-code; echo $?
0

Switch to git status --porcelain, which reports modifications and
untracked output, and print the offending paths and diff so the failure
is actionable.

Generated by Coder Agents on behalf of @zedkipp.

Originally discovered this problem here: #501 (comment)

@zedkipp zedkipp changed the title ci(.github/workflows/test.yml): fail Lint gen on newly created files ci: fail Lint gen on newly created files Apr 24, 2026
'git diff --exit-code' only inspects tracked files, so when 'make gen'
produces new Markdown (e.g. for a new resource or data source), the
check passes while the generated file remains uncommitted.

Switch the check to 'git status --porcelain' so both modifications and
untracked output fail the step, and print the offending paths and diff
for easier debugging.

Generated by Coder Agents on behalf of @zedkipp.
@zedkipp zedkipp force-pushed the ci/lint-gen-detect-new-files branch from d8aab13 to a49e0cd Compare April 24, 2026 19:44
@zedkipp zedkipp marked this pull request as ready for review April 24, 2026 19:49
@zedkipp zedkipp merged commit 74193bc into main Apr 24, 2026
7 checks passed
@zedkipp zedkipp deleted the ci/lint-gen-detect-new-files branch April 24, 2026 22:02
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants