Skip to content

feat(actions): annotate findings from terraform fmt, terraform-docs, and check-jsonschema - #26

Merged
posquit0 merged 1 commit into
mainfrom
feat/check-annotations-remaining
Sep 20, 2026
Merged

posquit0 merged 1 commit into
mainfrom
feat/check-annotations-remaining

Conversation

@posquit0

Copy link
Copy Markdown
Member

👋 Background

🔗 Related Issues

⚙️ Description

All three gain annotations_enabled (default true) and an Annotate Findings step that runs only after a failure and never fails the action.

Action Source of the annotation Line Title
terraform.fmt the captured diff: +++ new/<file> names the file, @@ -a,b +c,d @@ the first changed line of each hunk yes terraform fmt · Not formatted
terraform.docs the captured Error: <path> is out of date line (only with check: true) no, file-level terraform-docs · Out of date
github-actions.check-jsonschema re-run with --output-format json; errors[].filename and path no, file-level; schema validation has no line numbers check-jsonschema · <schema_type> with the JSON path in the message
  • terraform and terraform-docs print paths relative to the module, so target_dir is prefixed; check-jsonschema reports the repository-relative files it was given.
  • terraform.fmt and terraform.docs need no re-run since the captured output already carries the information.

Verification

  • yamllint, check-jsonschema, and shellcheck pass.
  • Each annotate script was run locally against real tool output (Terraform 1.16.3, terraform-docs 0.24.0, check-jsonschema 0.38.0): a recursive fmt diff yields one annotation per hunk with the module prefix, a recursive docs check names the stale submodule README, and a broken workflow yields a file annotation carrying $.jobs.x and the schema message.
  • Runner verification through a temporary PR is linked in a comment below.

🚨 To Reviewers

…and check-jsonschema

- Add `annotations_enabled` (default `true`) to the three remaining check
  actions on the same pattern as validate, tflint, and actionlint
- `terraform.fmt` reads the file and hunk line from the diff it captured;
  `terraform.docs` reads the stale file from its `is out of date` line; both
  prefix `target_dir` since the tools print module-relative paths
- `github-actions.check-jsonschema` re-runs with `--output-format json`;
  schema validation has no line numbers, so the annotation points at the
  file and names the failing JSON path
@github-actions

Copy link
Copy Markdown

GitHub Actions Integration

Repository actionlint check-jsonschema (workflows) check-jsonschema (actions)
tedilabs/github-actions

✅ All 1 passed.

@posquit0

Copy link
Copy Markdown
Member Author

Runner verification: #27 (closed) ran the three actions from this branch against failing fixtures, run https://github.com/tedilabs/github-actions/actions/runs/35524249993. Annotations recorded on the job:

Level Location Title Message
error fixtures/annotations2/tf/main.tf:1 terraform fmt · Not formatted Run terraform fmt to format this file.
error fixtures/annotations2/tf/sub/out.tf:1 terraform fmt · Not formatted Run terraform fmt to format this file.
error fixtures/annotations2/docs/README.md terraform-docs · Out of date Regenerate this file with terraform-docs.
error fixtures/annotations2/workflows/bad.yaml check-jsonschema · workflows $.jobs.x: … is not valid under any of the given schemas
error fixtures/annotations2/actions/bad/action.yaml check-jsonschema · actions $: 'description' is a required property
error fixtures/annotations2/actions/bad/action.yaml check-jsonschema · actions $.runs: … is not valid under any of the given schemas

fmt ran a second time with annotations_enabled: "false" and added nothing.

@posquit0
posquit0 merged commit 8b38c0b into main Sep 20, 2026
3 checks passed
@posquit0
posquit0 deleted the feat/check-annotations-remaining branch September 20, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant