diff --git a/content/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge.md b/content/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge.md index da7ac4443b..b56facb9e9 100644 --- a/content/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge.md +++ b/content/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge.md @@ -16,14 +16,20 @@ shortTitle: Add a status badge {% data reusables.repositories.actions-workflow-status-badge-intro %} -You reference the workflow by the name of your workflow file. -```markdown -![example workflow]({% ifversion fpt or ghec %}https://github.com{% else %}{% endif %}///actions/workflows//badge.svg) -``` +To add a workflow status badge to your `README.md` file, first find the URL for the status badge you would like to display. Then you can use Markdown to display the badge as an image in your `README.md` file. For more information about image markup in Markdown, see "[Basic writing and formatting syntax](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images)." + ## Using the workflow file name -This Markdown example adds a status badge for a workflow with the file path `.github/workflows/main.yml`. The `OWNER` of the repository is the `github` organization and the `REPOSITORY` name is `docs`. +You can build the URL for a workflow status badge using the name of the workflow file: + +``` +{% ifversion fpt or ghec %}https://github.com{% else %}{% endif %}///actions/workflows//badge.svg +``` + +To display the workflow status badge in your `README.md` file, use the Markdown markup for embedding images. For more information about image markup in Markdown, see "[Basic writing and formatting syntax](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images)." + +For example, add the following Markdown to your `README.md` file to add a status badge for a workflow with the file path `.github/workflows/main.yml`. The `OWNER` of the repository is the `github` organization and the `REPOSITORY` name is `docs`. ```markdown ![example workflow](https://github.com/github/docs/actions/workflows/main.yml/badge.svg) @@ -31,7 +37,9 @@ This Markdown example adds a status badge for a workflow with the file path `.gi ## Using the `branch` parameter -This Markdown example adds a status badge for a branch with the name `feature-1`. +To display the status of a workflow run for a specific branch, add `?branch=` to the end of the status badge URL. + +For example, add the following Markdown to your `README.md` file to display a status badge for a branch with the name `feature-1`. ```markdown ![example branch parameter](https://github.com/github/docs/actions/workflows/main.yml/badge.svg?branch=feature-1) @@ -39,7 +47,9 @@ This Markdown example adds a status badge for a branch with the name `feature-1` ## Using the `event` parameter -This Markdown example adds a badge that displays the status of workflow runs triggered by the `push` event, which will show the status of the build for the current state of that branch. +To display the status of workflow runs triggered by the `push` event, add `?event=push` to the end of the status badge URL. + +For example, add the following Markdown to your `README.md` file to display a badge with the status of workflow runs triggered by the `push` event, which will show the status of the build for the current state of that branch. ```markdown ![example event parameter](https://github.com/github/docs/actions/workflows/main.yml/badge.svg?event=push)