Skip to content

Monitor Github Actions builds for displaying in Grafana

License

Notifications You must be signed in to change notification settings

nrkno/grafana-github-actions

 
 

Repository files navigation

Grafana Github Actions Builds bridge

This projects monitors builds for specified projects in Github Actions, storing the status into a mysql database for consumption in grafana.

Example query

SELECT
  concat(owner, "/", repo, " (", workflowName, ")") as Project,
  concat(commitRef, " (", substring(commitSha, 1, 8), ")") as Ref,
  CONVERT(state, SIGNED) as State,
  stateMessage as Failed,
  TIMEDIFF(IFNULL(finished, NOW()), started) as Duration,
  created
FROM github_actions_builds
WHERE (created >= $__timeFrom() AND (created <= $__timeTo() OR finished <= $__timeTo() OR finished IS NULL))
ORDER BY created DESC
LIMIT 50

Installation

Ensure you have a running mysql server

Define the following environment variables, updating for your setup as appropriate:

  1. MYSQL_URL eg mysql://USERNAME:PASSWORD@HOST/DATABASE
  2. PROJECTS A comma separated list of projects to monitor eg julusian/node-elgato-stream-deck,bitfocus/companion
  3. GITHUB_TOKEN Personal access token token for github

It can be run in docker like:

docker run --restart=always \
  -e MYSQL_URL="mysql://USERNAME:PASSWORD@HOST/DATABASE" \
  -e PROJECTS=julusian/node-elgato-stream-deck,bitfocus/companion \
  -e GITHUB_TOKEN=______ \
   ghcr.io/julusian/grafana-github-actions

Or in node:

  1. yarn install
  2. yarn build
  3. node dist/index.js

Development

  1. yarn install
  2. yarn dev

About

Monitor Github Actions builds for displaying in Grafana

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • TypeScript 96.6%
  • Dockerfile 2.9%
  • Shell 0.5%