Skip to content

Report validation results on pull requests - #7

Merged
patrick-werner merged 1 commit into
mainfrom
pr-validation-feedback
Aug 19, 2026
Merged

Report validation results on pull requests#7
patrick-werner merged 1 commit into
mainfrom
pr-validation-feedback

Conversation

@patrick-werner

Copy link
Copy Markdown
Contributor

Why

The IG Publisher reports validation results in qa.xml rather than through its exit code. A build with errors therefore finished green, and nobody noticed unless they opened qa.html themselves. Pull requests only ever got a link to the published preview.

This ports the setup already in use in KDL-IG-Publisher, in all three stages.

1. The build fails on validation errors

patrick-werner/validation-outcome-markdown-renderer@v1 turns qa.xml into inline annotations on the diff and a summary table, and fails the job when an error survives. Warnings are annotated but do not fail — the ones meant to stay belong in input/ignoreWarnings.txt, which the publisher applies first.

2. The summary is posted to the pull request

Together with the deployment link, from the build job. It runs even when validation failed — that is when the report matters most — but not when the job was cancelled.

3. …and also when the PR is opened after the build

Repo-internal pull requests no longer build a second time: the branch's push event already built that commit. Forks and Dependabot keep building through their PR, since they have no push event to rely on.

That creates a gap. Push the branch, open the PR a moment later, and nothing reports back — the pull_request run is skipped, and the push run finished looking for a PR before one existed. The pr-comment job closes it: it finds the push run for the head commit, downloads its pr-summary artifact and posts the same comment. It builds nothing.

Details that matter in that job:

  • A push build still in flight is left alone — that run will find the PR by itself, and stepping in would race it with a half-finished result.
  • A missing or expired artifact (14 days) still produces a comment, just without the findings table.
  • It needs actions: read to read another run's artifact, which the workflow's default permissions do not include.
  • It checks out .github/scripts only, not the IG sources.

Both paths share .github/scripts/pr-comment.js, so the marker they use to find and update their comment cannot drift apart and start posting duplicates. It also truncates at 60000 characters, below GitHub's 65536 comment limit, and paginates when searching — the marker comment is the oldest one on the PR and would otherwise be missed on a busy one.

Verification

Check Result
Workflow parses jobs build, pr-comment
All five action versions exist checkout@v6, upload-artifact@v6, download-artifact@v6, github-script@v8, validation-outcome-markdown-renderer@v1
Referenced files present .github/scripts/pr-comment.js, scripts/gh-pages.sh, input/ignoreWarnings.txt
buildBody helper returns null with neither input, composes marker + findings + deployment otherwise

Note

The behaviour of the three stages together can only really be seen on a live pull request. This one is it: if the comment below carries a findings table and a preview link, all three worked.

The IG Publisher reports validation results in qa.xml rather than
through its exit code, so a build with errors finished green and nobody
noticed unless they opened qa.html. Pull requests only ever got a link
to the published preview.

A validation step now renders qa.xml into inline annotations and a
summary table, and fails the job when an error survives. Warnings are
annotated but do not fail; the ones meant to stay belong in
input/ignoreWarnings.txt, which the publisher applies first.

That summary is posted to the pull request together with the deployment
link, from the build job when the PR is already open.

Repo-internal pull requests no longer build a second time. The branch's
push event has already built that commit, so the pull_request run was
pure duplication - forks and Dependabot keep building through their PR,
since they have no push event to rely on. That leaves a gap: push the
branch, open the PR a moment later, and the push run is done looking for
a PR while the pull_request run is skipped. The pr-comment job closes
it by replaying the finished run's result - it finds the push run for
the head commit, downloads its summary artifact and posts the same
comment. It deliberately stands back while a push build is still in
flight, since that run will find the PR by itself.

Both paths share .github/scripts/pr-comment.js so the marker they use
to find and update their comment cannot drift apart and start posting
duplicates.

Ported from Gefyra/KDL-IG-Publisher, where this has been in use. All
five action versions verified to exist; the workflow parses and refers
only to files that are present.
@github-actions

Copy link
Copy Markdown
Contributor

FHIR Validation Results (filter: warnings)

❌ 0 errors (0 filtered), ⚠️ 4 warnings (0 filtered), ℹ️ 3 hints filtered out — 2026-08-19T07:35:29Z
FileSeverityDetailsLocationCodeMessageId
(unknown file)⚠️ warningThe HTML fragment 'ip-statements.xhtml' is not included anywhere in the produced implementation guide1not-found
(unknown file)⚠️ warningAn HTML fragment from the set [cross-version-analysis.xhtml, cross-version-analysis-inline.xhtml] is not included anywhere in the produced implementation guide2not-found
(unknown file)⚠️ warningAn HTML fragment from the set [dependency-table.xhtml, dependency-table-short.xhtml, dependency-table-nontech.xhtml] is not included anywhere in the produced implementation guide3not-found
(unknown file)⚠️ warningThe HTML fragment 'globals-table.xhtml' is not included anywhere in the produced implementation guide4not-found

Deployment

Open published IG for branch pr-validation-feedback

@patrick-werner
patrick-werner merged commit a0a2e82 into main Aug 19, 2026
4 checks passed
@patrick-werner
patrick-werner deleted the pr-validation-feedback branch August 19, 2026 08:27
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