LoginSignup
19
8

More than 3 years have passed since last update.

GitHub Actions でステータスバッジを表示する

Posted at

はじめに

GitHub Actions v2 でステータスバッジを表示する方法です。
意外と知らない方も多いようですがちゃんと表示できます。

ステータスバッジとは?

README.md でよく見るこういうやつです。1
actions-workflow-status-badge.png

ステータスバッジの表示

基本的にはドキュメントの通りです。
ワークフローを設定する - GitHub ヘルプ
継続的インテグレーションについて - GitHub ヘルプ

README.md に以下のコードを埋め込むと表示できます。

![](https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_NAME>/badge.svg)

<WORKFLOW_NAME> には name に設定された名前(空白文字は %20 に置換)か、ファイル名を指定できます。

ブランチを指定

branch パラメーターを付けることで特定のブランチを指定することが出来ます。

![](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?branch=feature-1)

イベントを指定

event パラメーターを付けることで特定のイベントを指定することが出来ます。

![](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?event=pull_request)

おわりに

ブランチとイベントの指定は最近追加されたようです。


  1. 画像は公式ドキュメントからお借りしました。 

19
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
8