🎓 A1Learner
🔍
0 of 50 lessons completed

GitHub Actions: The Status Badge

A status badge is a small image in the README that shows the latest run. It turns green when the workflow passes.

The badge line

This line goes in the README file.

[![CI](https://github.com/sanjay51/a1learner-github-actions-demo/actions/workflows/ci.yml/badge.svg)](https://github.com/sanjay51/a1learner-github-actions-demo/actions/workflows/ci.yml)

The parts

The link names the repository, the workflow file and the badge image.

actions/workflows/ci.yml/badge.svg

What it looks like

A green badge means the latest run passed.

CI passing

Example

[![CI](https://github.com/sanjay51/a1learner-github-actions-demo/actions/workflows/ci.yml/badge.svg)](https://github.com/sanjay51/a1learner-github-actions-demo/actions/workflows/ci.yml)

Key points

  • A status badge shows the latest result of one workflow.
  • Use a badge to see the health of a project at a glance.
  • The badge image comes from the workflow file name.
  • The badge reads passing when the latest run passed.
  • The badge reads failing when the latest run failed.
  • Add the badge near the top of the README.
  • One small image tells every visitor if the code is healthy.

In this example, the line is added to the README. The image part shows the badge. The link part opens the workflow runs page. The badge names the CI workflow file. After the next push, the badge reads CI passing.

Note

The badge shows the latest run on the default branch only.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What does the status badge show?