Skip to content

Make diagnostic to github annotation conversion infallible#83

Open
saecki wants to merge 1 commit into
mainfrom
infallible-github-annotations
Open

Make diagnostic to github annotation conversion infallible#83
saecki wants to merge 1 commit 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 🤔

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