---
title: Get the latest GitHub workflow run
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/github/github-workflow-run-get-latest
---

Retrieves the most recent GitHub Actions workflow run for a specific workflow. Useful when the exact Run ID is unknown — for example, immediately after triggering a run. Always returns at most one run.

For authentication setup, see [GitHub workflow run actions](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/github/github-workflow-run).

## Inputs

The following inputs are available for this action.

| Input                   | Type    | Description                                                                                                                                                                                                                                  | Example                                                     |
| ----------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| **token**               | String  | **Required.** GitHub Personal Access Token stored as a secret. Fine-grained PATs require Actions: read permission. Classic PATs require repo scope.                                                                                          | `"${{ :secrets:github-PAT-token }}"`                        |
| **owner**               | String  | **Required.** The account owner of the repository (user or organization login). Case-insensitive.                                                                                                                                            | `"octocat"`                                                 |
| **repo**                | String  | **Required.** Repository name without the .git suffix. Case-insensitive.                                                                                                                                                                     | `"Hello-World"`                                             |
| **workflowId**          | String  | **Required.** The workflow file name (for example, `deploy.yml`) or numeric workflow ID.                                                                                                                                                     | `"deploy.yml"`                                              |
| **branch**              | String  | **Optional.** Filter by branch name. Useful to narrow to runs triggered on a specific branch.                                                                                                                                                | `"main"`                                                    |
| **event**               | String  | **Optional.** Filter by triggering event type (for example, `push`, `pull_request`, `workflow_dispatch`).                                                                                                                                    | `"workflow_dispatch"`                                       |
| **status**              | String  | **Optional.** Filter by run status or conclusion. Allowed values: `completed`, `action_required`, `cancelled`, `failure`, `neutral`, `skipped`, `stale`, `success`, `timed_out`, `in_progress`, `queued`, `requested`, `waiting`, `pending`. | `"completed"`                                               |
| **actor**               | String  | **Optional.** Filter by the GitHub login of the user who triggered the workflow.                                                                                                                                                             | `"octocat"`                                                 |
| **headSHA**             | String  | **Optional.** Only return runs with this specific head commit SHA.                                                                                                                                                                           | `"5cd968b93ae41f708cd094303e80bd4fca09d980"`                |
| **excludePullRequests** | Boolean | **Optional.** If `true`, pull request information is omitted from the response. Default: `false`.                                                                                                                                            | `false`                                                     |
| **selectors**           | List    | **Optional.** JQ selectors to extract values from the response. The run is at `.workflow_runs[0]`. Common selectors: `.workflow_runs[0].id`, `.workflow_runs[0].status`, `.workflow_runs[0].conclusion`.                                     | `[{"name": "runId", "expression": ".workflow_runs[0].id"}]` |

## Outputs

This action returns the following outputs.

| Output           | Type    | Example                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **response**     | Object  | ```yaml {   "total_count": 15,   "workflow_runs": [     {       "id": 35064429580,       "name": "Deploy to staging",       "status": "completed",       "conclusion": "success",       "html_url": "https://github.com/owner/repo/actions/runs/35064429580",       "run_number": 15,       "event": "workflow_dispatch",       "head_branch": "main",       "created_at": "2026-09-16T06:35:42Z",       "updated_at": "2026-09-16T06:35:50Z"     }   ] } ``` |
| **success**      | Boolean | `success: true | false`                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **errorMessage** | String  | Contains the GitHub API error response body.                                                                                                                                                                                                                                                                                                                                                                                                                  |

## Example

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: get_latest_workflow_run description: Retrieve the most recent workflow run for a specific workflow steps:   - name: get_latest_run     type: action     action: gitHub.workflowRun.getLatest     version: 1     inputs:       token: ${{ :secrets:github-PAT-token }}       owner: your_user_name       repo: test-workflow       workflowId: deploy.yml       branch: main       event: workflow_dispatch       selectors:         - name: runId           expression: ".workflow_runs[0].id"         - name: conclusion           expression: ".workflow_runs[0].conclusion"         - name: htmlUrl           expression: ".workflow_runs[0].html_url"     next: end ``` |
