Skip to content

Make diagnostic to github annotation conversion infallible - #83

Draft
saecki wants to merge 2 commits into
mainfrom
infallible-github-annotations
Draft

Make diagnostic to github annotation conversion infallible#83
saecki wants to merge 2 commits into
mainfrom
infallible-github-annotations

Conversation

@saecki

@saecki saecki commented Jul 19, 2026

Copy link
Copy Markdown
Member

Instead, just omit the path and span information.

Fixes #63

Instead, just omit the path and span information.
Comment thread src/github/api/check.rs
pub struct Annotation {
pub path: String,
#[serde(flatten)]
pub span: Option<Span>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the GitHub API will accept that, according to the docs annotations require start_line and end_line. Maybe we can instead fallback to line 1 for both?

@elegaanz

Copy link
Copy Markdown
Member

Another option I have considered when the conversion fails is to embed the annotation as part of the check summary message, instead of tying it to a specific line.

@saecki

saecki commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Interesting, when using the ::error workflow command, these are optional: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-an-error-message
We could check if the documentation is just wrong and otherwise switch to the workflow command interface for annotations?

This seems to be a difference between check run and workflow annotations 🤔

@elegaanz
elegaanz force-pushed the infallible-github-annotations branch 4 times, most recently from 4059cdf to a477cad Compare July 21, 2026 12:26
@elegaanz
elegaanz force-pushed the infallible-github-annotations branch from a477cad to 4326ea7 Compare July 21, 2026 12:30
@elegaanz

Copy link
Copy Markdown
Member

Looks like they are required when using the API.

@saecki
saecki marked this pull request as draft July 22, 2026 13:25
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.

Error not annotated on github due to invalid span

2 participants