以下の内容はhttps://ohbarye.hatenablog.jp/entry/2021/05/01/desktop-notification-on-ci-finishより取得しました。


GitHub Actions workflowが完了したらデスクトップ通知を出す

Work with GitHub Actions in your terminal with GitHub CLI - The GitHub Blogにてアナウンスされた通りGitHub公式CLIghでworkflowの情報を取れるようになった。

記事中で紹介されているようにworkflowの実行が終わったらデスクトップ通知を出したりできる。

We’ve made it easier to stay on top of in-progress workflow runs with gh run watch, which you can use to either follow along as a workflow run executes or combine with other tools to alert you when runs are finished. Combining gh run watch with, on Ubuntu, a command like notify-send means more time to wander off from your keyboard and do something like pet a cat or gaze at a plant.

macOSではosascriptを使うことでデスクトップ通知を出せる。

function notify-github-actions-ci-finish() {
  gh run watch -i10 && osascript -e 'display notification "run is done!" with title "Terminal"'
}

alias nci=notify-github-actions-ci-finish

上記のようなaliasを.zshrcに登録し、git pushしたあとに呼び出す。するとworkflowが終わったタイミングで通知が来る。

f:id:ohbarye:20210501230345g:plain
通知のようす




以上の内容はhttps://ohbarye.hatenablog.jp/entry/2021/05/01/desktop-notification-on-ci-finishより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14