Get Detailed Analytics and Statistics from your Github Actions

Michel C
3 min readDec 8, 2021

--

Github actions logo (source)

I love Github Actions, love building them, love using them and love helping others use them. But that last part is a bit difficult as Github does not provide a way to get analytical data on your action’s usage by others such as: Who uses it? How often are they using it? Are there any errors when people try to use it? Do people try to use it and then decide not to due to some problems? Etc…

By getting the answers to these questions, Actions developers would be able to improve their actions to suit the needs of more people and make the experience for users better. So we decided to solve this problem and give developers the insights they need.

Getting Started

Start by creating you action, we’ll be using the code from Github’s tutorial on creating a new JS action you can find here.

Original code for the example JS Github action, written by the Github actions team♥️.

To start collecting data we install the gh-action-stats npm package:

npm install -S gh-action-stats

And then import it into our action and call the collectStats function as such:

Start collecting statistics

By doing this you will start collecting statistics on your action once it is run in the context of a runner (does not currently support self hosted runners).

Collecting Run Statistics

The configuration above will work well but will leave out two key pieces of information: Errors and Duration of the run (how long did your action take to run).
To get these information we need to call the collectStats function differently:

Collect Runtime Staistics

By creating a main function, and passing it to the collectStats function, gh-action-stats will be able to execute your main function (even if it is async), collect all the previous statistics, catch errors and log them, and monitor run duration!

Accessing Data

Once you’ve configured your action to collect statistics, you will want to access your data. Go to actions.boringday.co and log-in using your Github account. Note, you will only be able to see the statistics for the actions you own (i.e. which you are the creator of). Once logged in and some run data has been collected you will have your dashboard with the list of the actions you own and the last time they were used.

List of all your actions which currently have data

Select the action you wish to visualize and the following dashboard will appear giving you insights on your action.

Dashboard for my version-bumper action

Notes

For the privacy of those using the actions, you will not be able to see the name of the repository if it is private to you, you will still be able to see the repo owner’s name though if you want to contact them.

You can find the repository for the platform here: https://github.com/michmich112/gh-action-stats
And the npm package here: https://github.com/michmich112/gh-action-stats-js
You can visit our feature plans there and contributions are welcome!

This currently only works for JS Actions only, support for Docker images is on the way.

--

--

Michel C
Michel C

Written by Michel C

Product Manager @ Walmart Global Tech

No responses yet