1
0
mirror of synced 2026-01-09 06:03:09 -05:00

Merge pull request #29494 from github/jhosman-5676-markdown-badges-description

Clarify text above Markdown examples
This commit is contained in:
Jess Hosman
2022-08-03 13:40:13 -06:00
committed by GitHub

View File

@@ -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 %}<HOSTNAME>{% endif %}/<OWNER>/<REPOSITORY>/actions/workflows/<WORKFLOW_FILE>/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 %}<HOSTNAME>{% endif %}/<OWNER>/<REPOSITORY>/actions/workflows/<WORKFLOW_FILE>/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=<BRANCH_NAME>` 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)