> ## 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·GitHub

> ServerRpc로 Git과 GitHub 저장소 정보를 다루는 사용 예시입니다.

## Git·GitHub

대상: ServerRpc (Client에 연결된 서버 전체 작업)

RPC 전체 개요와 페이지 목록은 [RPC](https://kawax.biz/ko/packages/laravel-copilot-sdk/rpc.md)를 참조하세요.

## gitHubRepository

`gitHubRepository()->getById()`는 GitHub 저장소 ID로부터 owner/name을 해석하고, `lookupBranchPullRequest()`는 지정한 head owner와 브랜치를 우선순위대로 지정한 저장소에서 검색합니다. 둘 다 `authInfo`를 그대로 전달합니다. `getById()`의 결과는 `repository`에 owner/name을 포함하며, 찾지 못한 경우 `null`입니다. Pull Request 검색의 `status`는 `found`, `no-token`, `no-pr`, `lookup-failed` 중 하나이며, 알 수 없는 값은 문자열 그대로 유지되므로 예외가 발생하지 않습니다. `pullRequest`는 찾은 경우 연관 배열이고, 그 외에는 `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 개요](https://kawax.biz/ko/packages/laravel-copilot-sdk/rpc/server-overview.md)
- [RPC(Remote Procedure Call)](https://kawax.biz/ko/packages/laravel-copilot-sdk/rpc.md)
- [GitHub 토큰](https://kawax.biz/ko/packages/laravel-copilot-sdk/github-token.md)
- [GitHub Actions - GitHub Copilot SDK for Laravel](https://kawax.biz/ko/packages/laravel-copilot-sdk/github-actions.md)
- [GitHub Copilot SDK for Laravel](https://kawax.biz/ko/packages/laravel-copilot-sdk/index.md)


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