feat(reporter): add GitHub Actions workflow command reporter (#459)#461
Open
mvanhorn wants to merge 1 commit into
Open
feat(reporter): add GitHub Actions workflow command reporter (#459)#461mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
) Closes Boeing#459 Adds a new `--reporter=github` option that emits validation errors as GitHub Actions workflow commands (`::error file=PATH,line=N,col=M::MSG`) so they appear as inline PR annotations without needing the separate Boeing/validate-configs-action wrapper. Mimics how golangci-lint, eslint, and shellcheck integrate with GitHub Actions: valid files produce no output (workflow commands are for errors/warnings only); invalid files produce one annotation per failure with the file path, line/column when known, and the validation message. - New `pkg/reporter/github_reporter.go` (GitHubReporter + escape helpers) - New `pkg/reporter/github_reporter_test.go` (8 table-driven cases: empty input, error formatting, line/col handling, message escaping, property escaping, fallback to ValidationErrors slice, multiple reports) - `cmd/validator/validator.go`: register `github` in `acceptedReportTypes`, `getReporter` switch, and the help text (both `--help` block and the flag description) Special characters in messages are escaped per the workflow command spec (% -> %25, CR -> %0D, LF -> %0A); property values additionally escape : and , since those are field separators in `::error key=value,key=value::`.
kehoecj
requested changes
Apr 27, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--reporter=githuboption that emits validation errors as GitHub Actions workflow commands so they appear as inline PR annotations, without requiring the separate Boeing/validate-configs-action wrapper.Closes #459
Why this matters
Issue #459 noted that the existing
validate-configs-actionalready provides PR annotations, but it requires using the GitHub Action wrapper. Many users invoke the validator CLI directly inside their workflow steps and would benefit from getting annotations "for free" the same waygolangci-lint,eslint, andshellcheckintegrate with GitHub Actions.The output format follows the GitHub Actions workflow command spec:
Valid files produce no output (workflow commands are errors/warnings only, per the spec).
Changes
pkg/reporter/github_reporter.go—GitHubReporterplus theformatGitHubAnnotation/escapeGitHubMessage/escapeGitHubPropertyhelpers. Mirrors the existing reporter shapes (outputDest,Print(reports []Report) error,outputBytesToFilefor file output).pkg/reporter/github_reporter_test.go— 9 table-driven tests:ValidationErrors[0]then a generic message%, CR, LF in messages:and,in property values (file paths with special chars)cmd/validator/validator.go— registeredgithubinacceptedReportTypes, added a case togetReporter, and updated both the--helpblock and the flag description.Quiet-mode behavior
The reporter mirrors the existing
StdoutReporterquiet-mode contract: when the first report hasIsQuietset, stdout is suppressed even thoughbuildGitHubReportstill produces content. File output via--reporter=github:path.txtis unaffected by quiet mode (matching how the other reporters behave when explicit output destinations are set).Escaping
The GitHub workflow command spec requires escaping special characters:
%->%25, CR ->%0D, LF ->%0Afile=,line=,col=): same as MESSAGE plus:->%3Aand,->%2C(since those are field separators)Both escapers are covered by dedicated tests.
Testing
gofmt -lis clean on all touched files.This contribution was developed with AI assistance (Codex).