Sub topic 1
Where results show up: logs, annotations, summaries, artifacts, checks
Prerequisites
This chapter assumes you can read a GitHub Actions workflow file (jobs, steps, triggers). You should also be able to run a test suite from the command line and write basic Markdown. Later chapters build on the map given here.
Five places a workflow can report results
A workflow run produces output in five places. Each one has a different audience, lifetime, and cost to set up.
| Surface | What it holds | Where you see it | Set up by |
|---|---|---|---|
| Logs | Raw output of every step | The step's log in the run page | Nothing. It is automatic. |
| Annotations | Short warning or error messages tied to a file and line | Run page, "Files changed" tab of a pull request | Workflow commands printed to standard output |
| Job summary | Markdown written for humans | The run's summary page | Appending to the `GITHUB_STEP_SUMMARY` file |
| Artifacts | Files, such as XML reports or HTML coverage | A download link on the run page | `actions/upload-artifact` |
| Check runs | A named pass/fail result with details | The checks list on a pull request | A reporting action or the API |
Logs
Logs are the default. Every command's output lands here. They are complete but hard to scan. A failing test may be buried among thousands of lines, and logs are plain text, so they carry no tables or links. Use them for debugging, not for communicating results.
Annotations
An annotation is a message that GitHub attaches to a file and line. A step creates one by printing a workflow command:
echo "::warning file=src/app.py,line=10,title=Slow test::This test took longer than 5 seconds"
echo "::error file=src/app.py,line=42,title=Assertion failed::Expected 3 but got 4"On a pull request, these appear next to the changed code. This puts the failure where the reviewer is already looking.
Job summaries
A job summary is Markdown that a step writes to a file. GitHub renders it at the top of the run page. It suits a compact table of totals, such as tests passed and failed, and a coverage percentage. You get it without opening a single log.
Artifacts
An artifact is a file or folder saved from the run. Use artifacts for data that tools or people need in full: JUnit XML, coverage XML, HTML reports. They are kept for a limited retention period, then deleted.
Check runs
A check run is a named result, such as "Unit tests", with its own status and detail page. Branch protection rules can require specific checks to pass before merging. Every job already creates one automatically. Reporting actions can create extra ones with richer detail. Publishing them needs token permissions, covered in a later chapter.
How the pieces fit together
The signals form a pipeline. The test runner writes report files. Later steps turn those files into the other surfaces.
Notice that the report files are the common source. This is why the next chapters start with report formats. Once a runner writes a standard file, you can feed it to any surface.
Choosing a surface
- Need to debug a failure? Read the logs.
- Need reviewers to see a problem on a specific line? Use an annotation.
- Need a quick overview without opening logs? Write a job summary.
- Need the full data kept or processed elsewhere? Upload an artifact.
- Need merging blocked on a result? Use a required check.
Most good setups combine several. A common pattern is artifacts for the raw files, a summary for the overview, and annotations for individual failures.
Common mistakes
- Relying only on logs. Reviewers rarely read them.
- Putting large detail into annotations. Each message is meant to be short, and GitHub limits how many it shows per step.
- Forgetting that a step after a failed test is skipped by default. Later chapters show the status conditions that fix this.
Exercise
A reviewer wants to see, directly on a pull request's changed files, that line 42 of src/app.py fails an assertion. Which surface should you use, and how do you create it?
Show answer
Use an annotation. Print a workflow command from a step, for example echo "::error file=src/app.py,line=42,title=Assertion failed::Expected 3 but got 4". GitHub attaches it to that file and line in the run and pull request views.
Exercise
Which surface would you pick to keep a full coverage XML file for later download, and which for a short table of totals shown on the run page?
Show answer
Use an artifact (actions/upload-artifact) to keep the full XML file. Use a job summary (appending Markdown to GITHUBSTEPSUMMARY) for the table of totals.