> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Git and GitHub

> Use ServerRpc in Laravel Copilot SDK to work with Git and GitHub repository information.

## Git and GitHub

Scope: ServerRpc (server-wide operations tied to the Client)

For an overview of RPC and the list of all RPC pages, see [RPC](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md).

## gitHubRepository

`gitHubRepository()->getById()` resolves an owner and name from a GitHub repository ID, and `lookupBranchPullRequest()` searches the given repositories, in priority order, for a pull request from the given head owner and branch. Both take `authInfo` as is. The `getById()` result contains the owner and name in `repository`, or `null` when the repository isn't found. The pull request lookup `status` is one of `found`, `no-token`, `no-pr`, or `lookup-failed`. Unknown values are kept as strings, so they don't throw. `pullRequest` is an associative array when a pull request is found, otherwise `null`.

```php theme={null}
use Revolution\Copilot\Facades\Copilot;

$repository = Copilot::client()->rpc()->gitHubRepository();

$resolved = $repository->getById([
    'authInfo' => $authInfo,
    'repositoryId' => 12345,
]);

$lookup = $repository->lookupBranchPullRequest([
    'authInfo' => $authInfo,
    'headOwner' => 'octo',
    'baseRepositories' => [
        ['owner' => 'octo', 'name' => 'demo'],
        ['owner' => 'upstream', 'name' => 'demo'],
    ],
    'branch' => 'feature',
    'includeClosed' => false,
]);
```


## Related topics

- [ServerRpc overview](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc/server-overview.md)
- [RPC (Remote Procedure Call)](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md)
- [GitHub token](https://kawax.biz/en/packages/laravel-copilot-sdk/github-token.md)
- [GitHub Actions - GitHub Copilot SDK for Laravel](https://kawax.biz/en/packages/laravel-copilot-sdk/github-actions.md)
- [GitHub Copilot SDK for Laravel](https://kawax.biz/en/packages/laravel-copilot-sdk/index.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.