GitHub Actionsの結果をステータスバッジとしてリポジトリ に追加する。README.mdに追加しておく事でリポジトリ を表示した時にステータスバッジが表示される。
![](https://littleengineer.jp/wp-content/uploads/2021/03/image-5-1024x205.png)
Actions -> workflowを選択 -> 右上のメニューで”Create status badge”を選択
![](https://littleengineer.jp/wp-content/uploads/2021/03/image-7-1024x168.png)
表示されるMarkdownをコピー
![](https://littleengineer.jp/wp-content/uploads/2021/03/image-8.png)
コピーしたMarkdownをREADME.mdに追加
[![CI](https://github.com/little-engineer/bff-sample/actions/workflows/workflow.yml/badge.svg)](https://github.com/little-engineer/bff-sample/actions/workflows/workflow.yml)
# bff-sample
The sample of BFF(Backends For Frontends) using Spring Boot & Kotlin.
Previewにステータスバッジが追加されている事を確認
![](https://littleengineer.jp/wp-content/uploads/2021/03/image-9-1024x252.png)
デフォルトはリポジトリのデフォルトブランチに対するWorkflowの結果が表示されるが、以下のように個別ブランチを指定する事も可能(クエリーにbranchキーを追加してbranch名を設定)。
ここではtest/fail-unit-testというbranchを指定。
[![CI](https://github.com/little-engineer/bff-sample/actions/workflows/workflow.yml/badge.svg?branch=test/fail-unit-test)](https://github.com/little-engineer/bff-sample/actions/workflows/workflow.yml)
README.mdを上記のように変えた上で、UnitTestを意図的に失敗させるブランチtest/fail-unit-testをPushした場合、結果がfailingになる事を確認。
![](https://littleengineer.jp/wp-content/uploads/2021/03/image-10-1024x232.png)
参考
https://docs.github.com/ja/actions/managing-workflow-runs/adding-a-workflow-status-badge
コメントを残す