# Repository

## Create a check run for a repository

> Creates a check run on a commit with optional code annotations. Supports GitHub check runs and Azure DevOps build status. Useful for reporting CI/CD results, code quality checks, or custom validations. Annotations can highlight specific lines in files with issues.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CreateCheckDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in the format owner/repo"},"sha":{"type":"string","description":"Commit SHA to create the check for. For PRs, this should be the head commit SHA."},"pull_number":{"type":"number","description":"Pull request number. If provided, the check will be associated with this PR."},"title":{"type":"string","description":"Title of the check run"},"summary":{"type":"string","description":"Summary of the check results"},"text":{"type":"string","description":"Additional details about the check run"},"annotations":{"description":"List of annotations to add to the check run","type":"array","items":{"$ref":"#/components/schemas/CheckAnnotation"}},"details_url":{"type":"string","description":"Details URL that will appear in the GitHub UI"},"conclusion":{"type":"string","description":"Conclusion of the check run. Required when status is completed.","enum":["success","failure","neutral","cancelled","skipped","timed_out","action_required"],"default":"success"},"status":{"type":"string","description":"Status of the check run. Defaults to completed.","enum":["in_progress","completed"],"default":"completed"},"skip_comment":{"type":"boolean","description":"Skip posting a rich PR comment (ADO only). Use when the status badge is sufficient.","default":false},"check_category":{"type":"string","description":"Category of the check (analysis or validation). Used to construct web UI result page URLs."}},"required":["repositoryIdentifier","sha","title","summary"]},"CheckAnnotation":{"type":"object","properties":{"path":{"type":"string","description":"Path to the file being annotated"},"start_line":{"type":"number","description":"Start line number of the annotation"},"end_line":{"type":"number","description":"End line number of the annotation"},"annotation_level":{"type":"string","description":"Severity level of the annotation","enum":["notice","warning","failure"]},"message":{"type":"string","description":"Message to display in the annotation"},"title":{"type":"string","description":"Brief title for the annotation"}},"required":["path","start_line","end_line","annotation_level","message"]}}},"paths":{"/sfp/api/repository/checks":{"post":{"operationId":"RepositoryController_createCheck","summary":"Create a check run for a repository","description":"Creates a check run on a commit with optional code annotations. Supports GitHub check runs and Azure DevOps build status. Useful for reporting CI/CD results, code quality checks, or custom validations. Annotations can highlight specific lines in files with issues.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckDto"}}}},"responses":{"201":{"description":"The check run has been successfully created","content":{"application/json":{"schema":{"properties":{"id":{"type":"number","description":"The check run ID"},"html_url":{"type":"string","description":"URL to view the check run"},"conclusion":{"type":"string","enum":["success","failure","neutral"],"description":"The final conclusion of the check"},"status":{"type":"string","enum":["completed"],"description":"The current status of the check"}}}}}},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Repository"]}}}}
```

## Create a pull request in a repository

> Creates a new pull request between two branches. Supports draft pull requests. The source branch must have commits ahead of the target branch. Useful for automated PR creation in CI/CD workflows.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CreatePullRequestDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in the format owner/repo"},"sourceBranch":{"type":"string","description":"The source branch containing the changes"},"targetBranch":{"type":"string","description":"The target branch to merge changes into"},"title":{"type":"string","description":"Title of the pull request"},"description":{"type":"string","description":"Description of the pull request in markdown format"},"draft":{"type":"boolean","description":"Whether to create as a draft pull request","default":false},"userToken":{"type":"string","description":"Personal access token to create the PR as a specific user. For GitHub: use a PAT with repo scope. For GitLab: use a PAT with api scope. If omitted, PR is created using the configured app credentials."}},"required":["repositoryIdentifier","sourceBranch","targetBranch","title"]}}},"paths":{"/sfp/api/repository/pull-requests":{"post":{"operationId":"RepositoryController_createPullRequest","summary":"Create a pull request in a repository","description":"Creates a new pull request between two branches. Supports draft pull requests. The source branch must have commits ahead of the target branch. Useful for automated PR creation in CI/CD workflows.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePullRequestDto"}}}},"responses":{"201":{"description":"The pull request has been successfully created","content":{"application/json":{"schema":{"properties":{"id":{"type":"number","description":"The pull request ID"},"number":{"type":"number","description":"The pull request number"},"html_url":{"type":"string","description":"URL to view the pull request"},"state":{"type":"string","enum":["open","closed","merged"],"description":"Current state of the pull request"},"title":{"type":"string","description":"Pull request title"},"body":{"type":"string","description":"Pull request description"},"draft":{"type":"boolean","description":"Whether this is a draft pull request"}}}}}},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Repository"]}}}}
```

## Handle incoming GitHub webhook events

> Processes incoming GitHub webhook events. This is the endpoint that GitHub calls when events occur in the repository.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"paths":{"/sfp/api/repository/webhook":{"post":{"operationId":"RepositoryWebhookController_handleWebhook","summary":"Handle incoming GitHub webhook events","description":"Processes incoming GitHub webhook events. This is the endpoint that GitHub calls when events occur in the repository.","parameters":[{"name":"x-github-event","required":true,"in":"header","schema":{"type":"string"}},{"name":"x-github-delivery","required":true,"in":"header","schema":{"type":"string"}},{"name":"x-hub-signature-256","required":true,"in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"The webhook event has been processed successfully"}},"tags":["Repository / Webhooks"]}}}}
```

## Reopen a pull request

> Reopens a previously closed pull request. The PR must not have been merged. All previous history including comments and reviews is preserved.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"RepositoryIdentifierDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in the format owner/repo"}},"required":["repositoryIdentifier"]}}},"paths":{"/sfp/api/repository/pull-requests/{pull_number}/reopen":{"patch":{"operationId":"RepositoryController_reopenPullRequest","summary":"Reopen a pull request","description":"Reopens a previously closed pull request. The PR must not have been merged. All previous history including comments and reviews is preserved.","parameters":[{"name":"pull_number","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepositoryIdentifierDto"}}}},"responses":{"200":{"description":"The pull request has been successfully reopened","content":{"application/json":{"schema":{"properties":{"id":{"type":"number","description":"The pull request ID"},"number":{"type":"number","description":"The pull request number"},"state":{"type":"string","enum":["open"],"description":"Current state of the pull request"}}}}}},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Repository"]}}}}
```

## List open pull requests in a repository

> Lists pull requests with optional filtering by username and state. Supports GitHub and Azure DevOps repositories. Supports pagination. Can filter PRs created by or assigned to a specific user. Returns basic PR information including title, state, and branch details.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/repository/pull-requests":{"get":{"operationId":"RepositoryController_listPullRequests","summary":"List open pull requests in a repository","description":"Lists pull requests with optional filtering by username and state. Supports GitHub and Azure DevOps repositories. Supports pagination. Can filter PRs created by or assigned to a specific user. Returns basic PR information including title, state, and branch details.","parameters":[{"name":"repositoryIdentifier","required":true,"in":"query","description":"Repository identifier in format owner/repo (GitHub) or org/project/repo (Azure DevOps)","schema":{"type":"string"}},{"name":"username","required":false,"in":"query","description":"Filter pull requests by username","schema":{"type":"string"}},{"name":"state","required":false,"in":"query","description":"State of pull requests to return (default: open)","schema":{"enum":["open","closed","all"],"type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based, default: 1)","schema":{"type":"number"}},{"name":"per_page","required":false,"in":"query","description":"Number of results per page (default: 30, max: 100)","schema":{"type":"number"}}],"responses":{"200":{"description":"List of pull requests","content":{"application/json":{"schema":{"type":"array","items":{"properties":{"id":{"type":"number","description":"The pull request ID"},"number":{"type":"number","description":"The pull request number"},"html_url":{"type":"string","description":"URL to view the pull request"},"state":{"type":"string","enum":["open","closed","merged"],"description":"Current state of the pull request"},"title":{"type":"string","description":"Pull request title"},"body":{"type":"string","description":"Pull request description"},"user":{"type":"object","properties":{"login":{"type":"string","description":"username of the creator"}}},"created_at":{"type":"string","format":"date-time","description":"When the pull request was created"},"updated_at":{"type":"string","format":"date-time","description":"When the pull request was last updated"}}}}}}},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Repository"]}}}}
```

## Close a pull request

> Closes an open pull request without merging. The PR can be reopened later if needed. This action preserves all PR history including comments and reviews.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"RepositoryIdentifierDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in the format owner/repo"}},"required":["repositoryIdentifier"]}}},"paths":{"/sfp/api/repository/pull-requests/{pull_number}/close":{"patch":{"operationId":"RepositoryController_closePullRequest","summary":"Close a pull request","description":"Closes an open pull request without merging. The PR can be reopened later if needed. This action preserves all PR history including comments and reviews.","parameters":[{"name":"pull_number","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepositoryIdentifierDto"}}}},"responses":{"200":{"description":"The pull request has been successfully closed","content":{"application/json":{"schema":{"properties":{"id":{"type":"number","description":"The pull request ID"},"number":{"type":"number","description":"The pull request number"},"state":{"type":"string","enum":["closed"],"description":"Current state of the pull request"}}}}}},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Repository"]}}}}
```

## The RepositoryIdentifierDto object

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.0.0-beta.87"},"components":{"schemas":{"RepositoryIdentifierDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in the format owner/repo"}},"required":["repositoryIdentifier"]}}}}
```
