github-api icon indicating copy to clipboard operation
github-api copied to clipboard

Issues to get all the retryAttemps of an workflow

Open ananta-code opened this issue 11 months ago • 2 comments

Describe the bug I have a runner and which was retried 5 times and each runner has almost 25 jobs so when i use repository.getWorkflowRun(runnerId/workflow_id), it is returning the ghWorkFlowRunner but newWorkFlowRun.listJobs().toList() doesn't have all the retried job info

To Reproduce Steps to reproduce the behavior:

  1. Create a PR
  2. Cancel the first runner
  3. Retry the runner again and again
  4. newWorkFlowRun.listJobs().toList() should contain all the jobs irrespective of the retry attemps

Expected behavior newWorkFlowRun.listJobs().toList() is only returning most recent retried jobs

Desktop (please complete the following information):

  • OS: iOS
  • Version 1.326

Additional context Is there any way to get the runner specific to a runner id and retryAttempt. I have monorepo so repository.queryWorkflowRuns().list() and then filter by runnerId and retry attempt is not feasible for me since we have more than 3000 runners getting executed everyday.

ananta-code avatar Jan 02 '25 13:01 ananta-code

As noted in https://github.com/hub4j/github-api/issues/2005

Is there a REST API endpoint that does what you're asking?

Here's the documentation for the endpoint used by queryWorkflowRuns(): https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

If you call that without any filtering it will take a very long time indeed. Perhaps if you filter by created to exclude runs that happened outside a reasonable window?

Alternative. You can also start by filtering per workflow and they filter further: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow

bitwiseman avatar Jan 02 '25 22:01 bitwiseman

As noted in #2005

Is there a REST API endpoint that does what you're asking?

Here's the documentation for the endpoint used by queryWorkflowRuns(): https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

If you call that without any filtering it will take a very long time indeed. Perhaps if you filter by created to exclude runs that happened outside a reasonable window?

Alternative. You can also start by filtering per workflow and they filter further: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow

How to find individual org.kohsuke.github libraries for each of the rest endpoints. Is there any documentation for this?

ananta-code avatar Jan 06 '25 14:01 ananta-code