Search Code
github.search_code
ActionBusiness appsconnection required
Calls the GitHub API GET /search/code.
Search indexed source files across the repositories the token can read.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- Bearer token
- Providers
- GitHub
- Secret shape
- the GitHub personal access token
- Resolved by
- config.connection_id, else node.connection_id, else the tenant's sole GitHub connection
Configuration
4 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
q GitHub search query, including any qualifiers such as repo: or language:. | string | Yes | — | — | repo:octocat/hello-world fixme |
sort Sort by index time instead of best match. | string | No | — | one of "indexed" | — |
order Sort direction. | string | No | — | one of "asc", "desc" | — |
max_items Stop after this many rows; further pages are followed via the Link header. | number | No | 100 | 1–1000 | — |
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"max_items": 100,
"q": "repo:octocat/hello-world fixme"
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
items The matching files. | array | — |
items[].name File name. | string | — |
items[].path Path inside its repository. | string | — |
items[].sha Blob SHA of the matching file. | string | — |
items[].html_url Link to the file. | string | — |
items[].repository_full_name owner/repo the file is in. | string | — |
count How many rows this step returned. | number | — |
total_count How many matches GitHub found, beyond this page. | number | — |
incomplete_results True when GitHub timed out and the results are partial. | boolean | — |
{
"count": 0,
"incomplete_results": false,
"items": [
{
"html_url": "",
"name": "",
"path": "",
"repository_full_name": "",
"sha": ""
}
],
"total_count": 0
}Notes
- Code search only covers the default branch of indexed repositories, and the query must narrow the scope (repo:, org: or user:) unless the token is an enterprise one.
- GitHub returns at most 1000 results for any search, however high max_items is.
Solutions with GitHub
See Search Code run in a workflow.
In a technical demo we add the GitHub connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.