workflow-metrics icon indicating copy to clipboard operation
workflow-metrics copied to clipboard

API call always retrieves *all* workflow runs

Open isaac-canvas opened this issue 1 year ago • 0 comments

I've been trying this action out and we have a lot of workflow runs. It takes about an hour for the action to execute. This time is all spent in the request to the Github API because it there is no filtering on the workflow runs it retrieves.

This PR solve this problem by limiting the data retrieved by the API request to the date ranges provided. This will speed up the API request as well as the processing time when running the action. It also saves bandwith and processing time on GitHub's API server :D.

Locally this makes the action only take ~8 seconds when querying a week's worth of workflow runs, as opposed to ~1h.

Note: I think we could optionally add -F per_page=100 to the gh api command to always get the maximum results and make fewer requests. I didn't see any noticeable changes when adding this so I didn't include it.

isaac-canvas avatar Jan 16 '24 16:01 isaac-canvas