What are annotations?

In the email reports when my Workflow fails, I see mentions of annotations, like “$xyz succeeded (0 annotations)”.

What are annotations? The search bar on help.github.com doesn’t show any relevant results.

1 Like

Ahh, that email is confusing.

https://help.github.com/en/articles/about-status-checks

See the comments on the lines of code? That’s an annotation. We have an API that allows annotations to be created during a CI run.

checks-detailed

They aren’t supported in Actions yet, but will be.

5 Likes

@mscoutermarsh any idea when annotations will be supported again? I have a couple actions that need to be migrated to v2 that do this but I’m unable to create annotations with v2 actions. I can run v1 action in a v2 workflow and annotations will be created just fine, but a v2 style action doesn’t. I can create the checks run, but when I try to update it with the annotations I get a 422 response.

I have had some success (kind of) for adding annotations:

  1. Try to get the current check run by listing all the checks that are in_progress and then finding the current run. I wrote this helper. (In this case I can make some assumptions like that the name contains “test” -  your may not. In my case I also could have returned the only check run that is in progress because I know that only one would be running)
  2. Create the annotations. I am using my jest output.
  3. Updating the check run found in 1.

With this method I can add annotations:

The real downside is, that annotation can only be viewed in files changed with the commit:

… So because I wanted to add the test results directly to the failing test, I am out of luck when a test fails which has not been changed with the current commit.

Hopefully the code samples are helpful for you.

7 Likes

How can I add annotations to my npm test workflow which I have created?

My response after running the test:

[ { path: '.github/workflows/test.yml',  
blob\_href: 'repo...../.github/workflows/test.yml',  
start\_line: 1,  
start\_column: null,  
end\_line: 1,  
end\_column: null,  
annotation\_level: 'failure',  
title: '.github/workflows/test.yml#L1',  
message: 'Process completed with exit code 1.',  
raw\_details: null } ]  
  

I see when my check run is running the status is from ‘queued’ to ‘completed’. I dont see ‘in_progress’. Any thoughts what I am missing ?

Any update on this, or when the feature might be available?

5 Likes

Current way annotations where implemented seems quite weird for me as I was expecting to be able to create annotation reports on disk which would be loaded by github after the build finished, avoiding the need to perform API calls during build.

Current implementation just creates a vendor-lockin by requesting each tool that can produce annotation like output to add specific support for GitHub.

I asked recently on https://stackoverflow.com/questions/62516223/how-can-i-produce-github-annotations-by-creating-report-files-on-disk as I suppose I am not the first one that asks himself about lack of portability.

Do we have any file format that we can use for annotations and rely on a generic reported to send them to github?

1 Like