<p>You can get what you need using the <code>gh</code> cli and <code>awk</code>, like this:</p>
<pre><code>gh run list | awk -F'\t' 'NR&gt;1 {print $(NF-2), $(NF-1)}'
</code></pre>
<p>where:</p>
<ul>
<li><p>NR&gt;1 remove the header</p>
</li>
<li><p>$(NF-2) and $(NF-1) refer to the second (-1) and the third (-2) column,
starting from the end of the table, corresponding to the ID and ELAPSED columns.</p>
</li>
</ul>
<p>It should return something like this:</p>
<pre><code>7874944890 3m47s
7874879462 3m59s
7874758972 5m31s
7874637425 5m24s
7874341776 7m12s
7874341567 25s
</code></pre>
<p>Starting from this, you can adapt the <code>awk</code> command corresponding to your needs, and create a simple bash script to loop over it :)</p>

CC BY-SA 4.0
2024-02-13T11:25:08.393Z
2024-02-13T11:25:08.393Z
benCat
<p>Nothing like this exists in GitHub unfortunately. Insights will give you PR and merge statistics, but not build times or such. This would have to be implemented with a 3rd party tool or self-built.</p>

CC BY-SA 4.0
2023-07-28T18:50:42.400Z
2023-07-28T18:50:42.400Z
Preston Martin
<p>I'm in the process of migrating to GitHub Actions and I'm looking for some way to get statistics on my GitHub workflows like</p>
<ul>
<li>The average time it takes to build</li>
<li>The build success rate</li>
<li>The average time it takes to run tests</li>
<li>How all of these values change over time</li>
</ul>
<p>I'm not finding anything in GitHub that provides these types of insights. Is there something out there or do I have to home grow something?</p>

<github><github-actions>
CI statistics for GitHub actions
StaticMethod
# CI statistics for GitHub actions

(Asked by: username_0 on 2023-06-29)

I'm in the process of migrating to GitHub Actions and I'm looking for some way to get statistics on my GitHub workflows like

* The average time it takes to build
* The build success rate
* The average time it takes to run tests
* How all of these values change over time

I'm not finding anything in GitHub that provides these types of insights. Is there something out there or do I have to home grow something?

**Tags:** github, github-actions


---

## 2 answers

### Answer by username_1 on 2024-02-13. Score: 1

You can get what you need using the gh cli and awk, like this:
gh run list | awk -F'\t' 'NR>1 {print $(NF-2), $(NF-1)}'

where:

NR>1 remove the header

$(NF-2) and $(NF-1) refer to the second (-1) and the third (-2) column,
starting from the end of the table, corresponding to the ID and ELAPSED columns.


It should return something like this:
7874944890 3m47s
7874879462 3m59s
7874758972 5m31s
7874637425 5m24s
7874341776 7m12s
7874341567 25s

Starting from this, you can adapt the awk command corresponding to your needs, and create a simple bash script to loop over it :)


---

### Answer by username_2 on 2023-07-28. Score: 1

Nothing like this exists in GitHub unfortunately. Insights will give you PR and merge statistics, but not build times or such. This would have to be implemented with a 3rd party tool or self-built.


---

