Before you start
- An API key for your organization.
- The start of the period to measure.
- Your repository’s workflow files, to price each job by the runner it uses.
Read the model’s skips
Only a skip that Dynamic CI’s model decided can save time. A skip that a rule decided, such as a paths filter, is never counted as a saving. So ask only for the model’s skips:owner and name to read one repository. Then follow nextCursor while hasMore is true. Trunk keeps 90 days of decisions.
Decide which skips count
Leave out a decision whosefalseSkip is true, or whose estimate is null. Sort the rest by mode and outcome:
In Learning mode every job runs, so Actual is 0. A Learning skip whose job’s outcome is
skipped is not a Prospective saving either: your own CI conditions, such as an if: or a paths filter in your workflow, skipped that job already.
Work out hours and cost
estimate.durationMs is the job’s compute time, summed over all of its legs (matrix legs, shards or parallel steps). The hours saved are the sum of durationMs over the decisions that count, divided by 3,600,000.
To price a job, find its runner from runs-on in the workflow file at workflow.path, and use the runner provider’s price per minute. GitHub-hosted runners and most third-party runners bill each job by the minute, rounded up. Each leg is a job of its own, so round each leg up separately:
Project a normal week
If the period is shorter than a week, scale it up to 7 days. Weekdays are busier than weekends, so a short period gives a rough figure. For a better estimate, look at how a past week spread out: call the endpoint with the same filters andincludeTotal=true&limit=1, once over a whole past week and once over the same days and hours as your period. The week’s total divided by the period’s total is the factor to multiply by. Use a week with no holidays, and use only its counts: its decisions may reflect an older configuration.