ChristophWurst/xmllint-action

Fail build on XML Schema Parser error

falko opened this issue · 4 comments

falko commented

xmllint prints me a "Schemas parser warning" into the log file but the action reports as successful. Is there a chance to fail the build or at least mark it as unstable on such errors?

Background: My project creates schemas and example ob how to use them so I want to be warned if a PR break either the schema or the example without digging through the logs every time.

Example log output:

Error: BPM+/SDMN-Semantic.xsd:9: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at 'SCE/SCE0.xsd' for the namespace 'https://www.omg.org/spec/SCE/20211108/MODEL', since this namespace was already imported with the schema located at 'BPM+/SCE.xsd'.
examples/example.sdmn validates

See: https://github.com/omg-bpm-taskforces/omg-bpm-specs/actions/runs/6562892901/job/17825889588?pr=11

I think that would depend on the xmllint exit code. Could you check that?

falko commented

It exits with 0. Probably because the XML file is valid and it's just a warning on the schema.

However, at least the problem matcher catches it and shows the annotation in the changed files list of a PR even as "Unchanged files with check annotations": https://github.com/omg-bpm-taskforces/omg-bpm-specs/pull/11/files#diff-cb0d64aa5ec25d9f165780081eae24651e426d7ee9ae87e6717d787ddf9f3e1a

So if a matcher could fail the build it could be a solution.

falko commented

The ADR on problem matchers doesn't look like they have influence on the build result.

The action itself could check the contents of stderr and change its exit code or at least return it as an output

falko commented

I think, I'll live with the annotations give that we are reviewing all files before merging a PR.