How do I get a workflow's run duration after a re-run was triggered?

I want to calculate the time a workflow run takes to complete, up to a certain step.
To achieve this, I am using the “get a workflow run” API, in conjunction with the datediff utility found in dateutils like this:

- name: Get workflow Run ID
  uses: octokit/request-action@v2.x
  id: workflowRunId
    route: GET /repos/$myorg/$myrepo/actions/runs/${{ github.run_id }}
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get time diff between now and workflow run creation time
  id: workflowDuration
  run: |
    rpm -qa | grep dateutils || rpm -i
    NOW=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
    DIFF=`ddiff -i "%Y-%m-%dT%H:%M:%SZ" "${{ fromJson( }}" $NOW -f "%H°%M'%S\" to complete."`

However, if the run fails and then gets restarted, the above code outputs the diff between the first run (when the run was first “created_at”), not the timestamp that it got re-triggered.

Does anyone know how to do this with the API, or even with some other method?