gh-workflow-stats icon indicating copy to clipboard operation
gh-workflow-stats copied to clipboard

Allow filtering workflows by more than one status value

Open IvanRibakov opened this issue 1 year ago • 2 comments

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.

IvanRibakov avatar Oct 02 '24 10:10 IvanRibakov

Hi, @fchimpan is there anything I can do to help you review/merge this PR?

IvanRibakov avatar Oct 03 '24 09:10 IvanRibakov

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!

fchimpan avatar Oct 03 '24 11:10 fchimpan

Hi @fchimpan, any thoughts on the PR?

IvanRibakov avatar Oct 14 '24 07:10 IvanRibakov

@IvanRibakov Understood, thank you! I think your suggestion is very good. I will refactor it on my side if necessary. Thanks again!

fchimpan avatar Oct 27 '24 15:10 fchimpan