[BUG?] the REST API that get workflow run returns wrong pull request info

Apologize for adding that question mark. Actually I’m not really sure if it a bug, but when I tried to get the pull request info which triggered the workflow run, I found a different pull request.

In my repo Laurenfrost/ActionsTest, I closed the pull_request number 5, and that trigger a workflow run https://github.com/Laurenfrost/ActionsTest/actions/runs/1578145440.

However, when I GET the workflow run info with https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440, the pull_requests showed it is number 6. That confused me a lot.

Does anyone know how does it happen?

  "id": 1578145440,
  "name": "Show Trigger Events",
  "node_id": "WFR_kwLOErVgq85eEJag",
  "head_branch": "next",
  "head_sha": "09e5238cadb749785f29da4c562857a90ac55dce",
  "run_number": 32,
  "event": "pull_request",
  "status": "completed",
  "conclusion": "success",
  "workflow_id": 16281477,
  "check_suite_id": 4652771218,
  "check_suite_node_id": "CS_kwDOErVgq88AAAABFVOnkg",
  "url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440",
  "html_url": "https://github.com/Laurenfrost/ActionsTest/actions/runs/1578145440",
  "pull_requests": [
      "url": "https://api.github.com/repos/Laurenfrost/ActionsTest/pulls/6",
      "id": 804305832,
      "number": 6,
      "head": {
        "ref": "next",
        "sha": "64a34d649db20f60693909135135b3291f638f5b",
        "repo": {
          "id": 313876651,
          "url": "https://api.github.com/repos/Laurenfrost/ActionsTest",
          "name": "ActionsTest"
      "base": {
        "ref": "new",
        "sha": "462e752da3c5c29945b40cce9583875397565045",
        "repo": {
          "id": 313876651,
          "url": "https://api.github.com/repos/Laurenfrost/ActionsTest",
          "name": "ActionsTest"
  "created_at": "2021-12-14T13:53:34Z",
  "updated_at": "2021-12-14T13:53:48Z",
  "run_attempt": 1,
  "run_started_at": "2021-12-14T13:53:34Z",
  "jobs_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440/jobs",
  "logs_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440/logs",
  "check_suite_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/check-suites/4652771218",
  "artifacts_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440/artifacts",
  "cancel_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440/cancel",
  "rerun_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/runs/1578145440/rerun",
  "previous_attempt_url": null,
  "workflow_url": "https://api.github.com/repos/Laurenfrost/ActionsTest/actions/workflows/16281477",
  "head_commit": {
    "id": "09e5238cadb749785f29da4c562857a90ac55dce",
    "tree_id": "7f8ed692c1fb874e98ae16d6311279636c57d6aa",
    "message": "Delete TEST-com.bmwcarit.barefoot.analysis.DBCANTest.xml",
    "timestamp": "2021-12-14T13:37:17Z",
    "author": {
      "name": "Linwei Ye",
      "email": "bellfahle@outlook.com"
    "committer": {
      "name": "GitHub",
      "email": "noreply@github.com"
1 Like

I’m pretty sure pull_requests is the list of open pull requests, it’s provided for convenience and not particularly related to the event.

1 Like

Thank you! That makes sense.

It seems the document not mention the usage of pull_requests in the response. Could you please tell me where shoud I go to know about that.

The “documentation” is here:

If you’re up for it, you could file a bug:

Personally, I agree that the documentation is inadequate, it has a field, but in the example there are 0 entries, so it isn’t possible to divine what it is. (If it had 3, one a couple before the PR and one after, and one somewhere, that’d make it fairly clear that it isn’t related to the run…)

1 Like

Couldn’t agree more. Maybe I should open an isssue.

Thank you every much!

1 Like