gh-workflow-stats
gh-workflow-stats copied to clipboard
Allow filtering workflows by more than one status value
This PR turns --status flag into a slice of strings, allowing to filter by more than one status value.
Primary motivation for this change is to be able to exclude cancelled workflow runs from the success/failure analysis as we are using cancel-in-progress: true workflow setting which results in quite a big number of cancelled jobs that significantly skew reported success/failure rate:
$ gh workflow-stats ... --created ">=2024-09-25"
🏃 Total runs: 32
✔ Success: 12 (37.5%)
✖ Failure: 10 (31.2%)
🤔 Others: 10 (31.2%)
$ gh workflow-stats ... --created ">=2024-09-25" -s success,failure
🏃 Total runs: 22
✔ Success: 12 (54.5%)
✖ Failure: 10 (45.5%)
🤔 Others: 0 (0.0%)
P.S.
This PR also fixes a bug where using previous status filter implementation did NOT correctly filter all run attempts by status as only the last attempts were filtered while previous run attempts were added to the result set without filtering by status.
Hi, @fchimpan is there anything I can do to help you review/merge this PR?
Hi, @IvanRibakov Thank you for the great PR! I plan to take some time over the weekend to review it, so please wait a little. Thanks!
Hi @fchimpan, any thoughts on the PR?
@IvanRibakov Understood, thank you! I think your suggestion is very good. I will refactor it on my side if necessary. Thanks again!