Skip to content

githarbor

Class info

Re-exported classes

Class Module Description
AuthenticationError githarbor.exceptions Raised when authentication fails.
BaseRepository githarbor.core.base Base repository class. All methods raise FeatureNotSupportedError by default.
Branch githarbor.core.models Branch(name: 'str', sha: 'str', protected: 'bool' = False, default: 'bool' = False, created_at: 'datetime
Comment githarbor.core.models Comment(id: 'str', body: 'str', author: 'User', created_at: 'datetime', updated_at: 'datetime
Commit githarbor.core.models Commit(sha: 'str', message: 'str', author: 'User
GitHarborError githarbor.exceptions Base exception for GitHarbor.
Issue githarbor.core.models Issue(number: 'int', title: 'str', description: 'str' = '', state: 'str' = 'open', author: 'User
Label githarbor.core.models Label(name: 'str', color: 'str' = '', description: 'str' = '', created_at: 'datetime
OperationNotAllowedError githarbor.exceptions Raised when an operation is not allowed.
ProviderNotConfiguredError githarbor.exceptions Raised when provider is not properly configured (missing token etc).
PullRequest githarbor.core.models Pull request model.
RateLimitError githarbor.exceptions Raised when API rate limit is exceeded.
Release githarbor.core.models Model representing a repository release.
RepositoryNotFoundError githarbor.exceptions Raised when a repository cannot be found.
ResourceNotFoundError githarbor.exceptions Raised when a requested resource is not found.
User githarbor.core.models User or organization account on a Git hosting platform.
Workflow githarbor.core.models Workflow(id: 'str', name: 'str', path: 'str', state: 'str', created_at: 'datetime
WorkflowRun githarbor.core.models WorkflowRun(id: 'str', name: 'str', workflow_id: 'str', status: 'str', conclusion: 'str

🛈 DocStrings

GitHarbor: main package.

Unified client for GitHub, GitLab and BitBucket.

AuthenticationError

Bases: GitHarborError

Raised when authentication fails.

Source code in src/githarbor/exceptions.py
class AuthenticationError(GitHarborError):
    """Raised when authentication fails."""

BaseRepository

Base repository class. All methods raise FeatureNotSupportedError by default.

Source code in src/githarbor/core/base.py
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
class BaseRepository:
    """Base repository class. All methods raise FeatureNotSupportedError by default."""

    is_async: ClassVar[bool] = False
    url_patterns: ClassVar[list[str]] = []
    _owner: str = ""
    _name: str = ""

    @property
    def name(self) -> str:
        """The name of the repository."""
        return self._name

    @property
    def owner(self) -> str:
        """The owner of the repository."""
        return self._owner

    @property
    def default_branch(self) -> str:
        """The default branch of this repository."""
        raise NotImplementedError

    @property
    def edit_base_uri(self) -> str | None:
        """The edit uri prefix of a repository."""
        return None

    @classmethod
    def supports_url(cls, url: str) -> bool:
        return any(pattern in url for pattern in cls.url_patterns)

    @classmethod
    def from_url(cls, url: str, **kwargs: Any) -> BaseRepository:
        msg = f"{cls.__name__} does not implement from_url"
        raise FeatureNotSupportedError(msg)

    def get_repo_user(self) -> User:
        msg = f"{self.__class__.__name__} does not implement get_repo_user"
        raise FeatureNotSupportedError(msg)

    def get_branch(self, name: str) -> Branch:
        msg = f"{self.__class__.__name__} does not implement get_branch"
        raise FeatureNotSupportedError(msg)

    def list_branches(self) -> list[Branch]:
        msg = f"{self.__class__.__name__} does not implement list_branches"
        raise FeatureNotSupportedError(msg)

    def get_pull_request(self, number: int) -> PullRequest:
        msg = f"{self.__class__.__name__} does not implement get_pull_request"
        raise FeatureNotSupportedError(msg)

    def list_pull_requests(self, state: PullRequestState = "open") -> list[PullRequest]:
        msg = f"{self.__class__.__name__} does not implement list_pull_requests"
        raise FeatureNotSupportedError(msg)

    def get_issue(self, issue_id: int) -> Issue:
        msg = f"{self.__class__.__name__} does not implement get_issue"
        raise FeatureNotSupportedError(msg)

    def list_issues(self, state: IssueState = "open") -> list[Issue]:
        msg = f"{self.__class__.__name__} does not implement list_issues"
        raise FeatureNotSupportedError(msg)

    def create_issue(
        self,
        title: str,
        body: str,
        labels: list[str] | None = None,
        assignees: list[str] | None = None,
    ) -> Issue:
        """Create a new issue."""
        msg = f"{self.__class__.__name__} does not implement create_issue"
        raise FeatureNotSupportedError(msg)

    def get_commit(self, sha: str) -> Commit:
        msg = f"{self.__class__.__name__} does not implement get_commit"
        raise FeatureNotSupportedError(msg)

    def list_commits(
        self,
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        msg = f"{self.__class__.__name__} does not implement list_commits"
        raise FeatureNotSupportedError(msg)

    def get_workflow(self, workflow_id: str) -> Workflow:
        msg = f"{self.__class__.__name__} does not implement get_workflow"
        raise FeatureNotSupportedError(msg)

    def list_workflows(self) -> list[Workflow]:
        msg = f"{self.__class__.__name__} does not implement list_workflows"
        raise FeatureNotSupportedError(msg)

    def get_workflow_run(self, run_id: str) -> WorkflowRun:
        msg = f"{self.__class__.__name__} does not implement get_workflow_run"
        raise FeatureNotSupportedError(msg)

    def download(
        self,
        path: str,
        destination: JoinablePathLike,
        recursive: bool = False,
    ) -> None:
        msg = f"{self.__class__.__name__} does not implement download"
        raise FeatureNotSupportedError(msg)

    def search_commits(
        self,
        query: str,
        branch: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        msg = f"{self.__class__.__name__} does not implement search_commits"
        raise FeatureNotSupportedError(msg)

    def iter_files(
        self,
        path: str = "",
        ref: str | None = None,
        pattern: str | None = None,
    ) -> Iterator[str]:
        msg = f"{self.__class__.__name__} does not implement iter_files"
        raise FeatureNotSupportedError(msg)

    def get_contributors(
        self,
        sort_by: Literal["commits", "name", "date"] = "commits",
        limit: int | None = None,
    ) -> list[User]:
        msg = f"{self.__class__.__name__} does not implement get_contributors"
        raise FeatureNotSupportedError(msg)

    def get_languages(self) -> dict[str, int]:
        msg = f"{self.__class__.__name__} does not implement get_languages"
        raise FeatureNotSupportedError(msg)

    def compare_branches(
        self,
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]:
        msg = f"{self.__class__.__name__} does not implement compare_branches"
        raise FeatureNotSupportedError(msg)

    def get_latest_release(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
    ) -> Release:
        msg = f"{self.__class__.__name__} does not implement get_latest_release"
        raise FeatureNotSupportedError(msg)

    def list_releases(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
        limit: int | None = None,
    ) -> list[Release]:
        msg = f"{self.__class__.__name__} does not implement list_releases"
        raise FeatureNotSupportedError(msg)

    def get_release(self, tag: str) -> Release:
        msg = f"{self.__class__.__name__} does not implement get_release"
        raise FeatureNotSupportedError(msg)

    def get_tag(self, name: str) -> Tag:
        msg = f"{self.__class__.__name__} does not implement get_tag"
        raise FeatureNotSupportedError(msg)

    def list_tags(self) -> list[Tag]:
        msg = f"{self.__class__.__name__} does not implement list_tags"
        raise FeatureNotSupportedError(msg)

    def create_pull_request(
        self,
        title: str,
        body: str,
        head_branch: str,
        base_branch: str,
        draft: bool = False,
    ) -> PullRequest:
        msg = f"{self.__class__.__name__} does not implement create_pull_request"
        raise FeatureNotSupportedError(msg)

    def create_branch(
        self,
        name: str,
        base_commit: str,
    ) -> Branch:
        """Create a new branch at the specified commit."""
        msg = f"{self.__class__.__name__} does not implement create_branch"
        raise FeatureNotSupportedError(msg)

    def create_pull_request_from_diff(
        self,
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest:
        """Create a pull request from a diff string."""
        msg = f"{self.__class__.__name__} does not implement create_pull_request_from_diff"
        raise FeatureNotSupportedError(msg)

    def add_pull_request_comment(
        self,
        number: int,
        body: str,
    ) -> Comment:
        msg = f"{self.__class__.__name__} does not implement add_pull_request_comment"
        raise FeatureNotSupportedError(msg)

    def add_pull_request_review_comment(
        self,
        number: int,
        body: str,
        commit_id: str,
        path: str,
        position: int,
    ) -> Comment:
        fn_name = "add_pull_request_review_comment"
        msg = f"{self.__class__.__name__} does not implement {fn_name}"
        raise FeatureNotSupportedError(msg)

    async def get_repo_user_async(self) -> User:
        """Get repository owner information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_repo_user_async"
        raise FeatureNotSupportedError(msg)

    async def get_branch_async(self, name: str) -> Branch:
        """Get branch information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_branch_async"
        raise FeatureNotSupportedError(msg)

    async def get_pull_request_async(self, number: int) -> PullRequest:
        """Get pull request information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_pull_request_async"
        raise FeatureNotSupportedError(msg)

    async def list_pull_requests_async(
        self,
        state: PullRequestState = "open",
    ) -> list[PullRequest]:
        """List pull requests asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_pull_requests_async"
        raise FeatureNotSupportedError(msg)

    async def get_issue_async(self, issue_id: int) -> Issue:
        """Get issue information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_issue_async"
        raise FeatureNotSupportedError(msg)

    async def list_issues_async(self, state: IssueState = "open") -> list[Issue]:
        """List issues asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_issues_async"
        raise FeatureNotSupportedError(msg)

    async def create_issue_async(
        self,
        title: str,
        body: str,
        labels: list[str] | None = None,
        assignees: list[str] | None = None,
    ) -> Issue:
        """Create a new issue asynchronously."""
        msg = f"{self.__class__.__name__} does not implement create_issue_async"
        raise FeatureNotSupportedError(msg)

    async def get_commit_async(self, sha: str) -> Commit:
        """Get commit information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_commit_async"
        raise FeatureNotSupportedError(msg)

    async def list_commits_async(
        self,
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        """List commits asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_commits_async"
        raise FeatureNotSupportedError(msg)

    async def get_workflow_async(self, workflow_id: str) -> Workflow:
        """Get workflow information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_workflow_async"
        raise FeatureNotSupportedError(msg)

    async def list_workflows_async(self) -> list[Workflow]:
        """List workflows asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_workflows_async"
        raise FeatureNotSupportedError(msg)

    async def get_workflow_run_async(self, run_id: str) -> WorkflowRun:
        """Get workflow run information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_workflow_run_async"
        raise FeatureNotSupportedError(msg)

    async def download_async(
        self,
        path: str,
        destination: JoinablePathLike,
        recursive: bool = False,
    ) -> None:
        """Download repository content asynchronously."""
        msg = f"{self.__class__.__name__} does not implement download_async"
        raise FeatureNotSupportedError(msg)

    async def search_commits_async(
        self,
        query: str,
        branch: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        """Search commits asynchronously."""
        msg = f"{self.__class__.__name__} does not implement search_commits_async"
        raise FeatureNotSupportedError(msg)

    async def get_contributors_async(
        self,
        sort_by: Literal["commits", "name", "date"] = "commits",
        limit: int | None = None,
    ) -> list[User]:
        """Get repository contributors asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_contributors_async"
        raise FeatureNotSupportedError(msg)

    async def get_languages_async(self) -> dict[str, int]:
        """Get repository language statistics asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_languages_async"
        raise FeatureNotSupportedError(msg)

    async def compare_branches_async(
        self,
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]:
        """Compare two branches asynchronously."""
        msg = f"{self.__class__.__name__} does not implement compare_branches_async"
        raise FeatureNotSupportedError(msg)

    async def get_latest_release_async(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
    ) -> Release:
        """Get latest release asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_latest_release_async"
        raise FeatureNotSupportedError(msg)

    async def list_releases_async(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
        limit: int | None = None,
    ) -> list[Release]:
        """List releases asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_releases_async"
        raise FeatureNotSupportedError(msg)

    async def get_release_async(self, tag: str) -> Release:
        """Get release by tag asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_release_async"
        raise FeatureNotSupportedError(msg)

    async def get_tag_async(self, name: str) -> Tag:
        """Get tag information asynchronously."""
        msg = f"{self.__class__.__name__} does not implement get_tag_async"
        raise FeatureNotSupportedError(msg)

    async def list_tags_async(self) -> list[Tag]:
        """List all tags asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_tags_async"
        raise FeatureNotSupportedError(msg)

    async def list_branches_async(self) -> list[Branch]:
        """List all branches asynchronously."""
        msg = f"{self.__class__.__name__} does not implement list_branches_async"
        raise FeatureNotSupportedError(msg)

    async def create_pull_request_async(
        self,
        title: str,
        body: str,
        head_branch: str,
        base_branch: str,
        draft: bool = False,
    ) -> PullRequest:
        msg = f"{self.__class__.__name__} does not implement create_pull_request_async"
        raise FeatureNotSupportedError(msg)

    async def create_branch_async(
        self,
        name: str,
        base_commit: str,
    ) -> Branch:
        """Create a new branch at the specified commit asynchronously."""
        msg = f"{self.__class__.__name__} does not implement create_branch_async"
        raise FeatureNotSupportedError(msg)

    async def add_pull_request_comment_async(
        self,
        number: int,
        body: str,
    ) -> Comment:
        msg = f"{self.__class__.__name__} does not implement add_pull_request_comment_async"
        raise FeatureNotSupportedError(msg)

    async def add_pull_request_review_comment_async(
        self,
        number: int,
        body: str,
        commit_id: str,
        path: str,
        position: int,
    ) -> Comment:
        fn_name = "add_pull_request_review_comment_async"
        msg = f"{self.__class__.__name__} does not implement {fn_name}"
        raise FeatureNotSupportedError(msg)

    async def create_pull_request_from_diff_async(
        self,
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest:
        """Create a pull request from a diff string asynchronously."""
        fn_name = "create_pull_request_from_diff_async"
        msg = f"{self.__class__.__name__} does not implement {fn_name}"
        raise FeatureNotSupportedError(msg)

default_branch property

default_branch: str

The default branch of this repository.

edit_base_uri property

edit_base_uri: str | None

The edit uri prefix of a repository.

name property

name: str

The name of the repository.

owner property

owner: str

The owner of the repository.

compare_branches_async async

compare_branches_async(
    base: str,
    head: str,
    include_commits: bool = True,
    include_files: bool = True,
    include_stats: bool = True,
) -> dict[str, Any]

Compare two branches asynchronously.

Source code in src/githarbor/core/base.py
async def compare_branches_async(
    self,
    base: str,
    head: str,
    include_commits: bool = True,
    include_files: bool = True,
    include_stats: bool = True,
) -> dict[str, Any]:
    """Compare two branches asynchronously."""
    msg = f"{self.__class__.__name__} does not implement compare_branches_async"
    raise FeatureNotSupportedError(msg)

create_branch

create_branch(name: str, base_commit: str) -> Branch

Create a new branch at the specified commit.

Source code in src/githarbor/core/base.py
def create_branch(
    self,
    name: str,
    base_commit: str,
) -> Branch:
    """Create a new branch at the specified commit."""
    msg = f"{self.__class__.__name__} does not implement create_branch"
    raise FeatureNotSupportedError(msg)

create_branch_async async

create_branch_async(name: str, base_commit: str) -> Branch

Create a new branch at the specified commit asynchronously.

Source code in src/githarbor/core/base.py
async def create_branch_async(
    self,
    name: str,
    base_commit: str,
) -> Branch:
    """Create a new branch at the specified commit asynchronously."""
    msg = f"{self.__class__.__name__} does not implement create_branch_async"
    raise FeatureNotSupportedError(msg)

create_issue

create_issue(
    title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
) -> Issue

Create a new issue.

Source code in src/githarbor/core/base.py
def create_issue(
    self,
    title: str,
    body: str,
    labels: list[str] | None = None,
    assignees: list[str] | None = None,
) -> Issue:
    """Create a new issue."""
    msg = f"{self.__class__.__name__} does not implement create_issue"
    raise FeatureNotSupportedError(msg)

create_issue_async async

create_issue_async(
    title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
) -> Issue

Create a new issue asynchronously.

Source code in src/githarbor/core/base.py
async def create_issue_async(
    self,
    title: str,
    body: str,
    labels: list[str] | None = None,
    assignees: list[str] | None = None,
) -> Issue:
    """Create a new issue asynchronously."""
    msg = f"{self.__class__.__name__} does not implement create_issue_async"
    raise FeatureNotSupportedError(msg)

create_pull_request_from_diff

create_pull_request_from_diff(
    title: str,
    body: str,
    base_branch: str,
    diff: str,
    head_branch: str | None = None,
    draft: bool = False,
) -> PullRequest

Create a pull request from a diff string.

Source code in src/githarbor/core/base.py
def create_pull_request_from_diff(
    self,
    title: str,
    body: str,
    base_branch: str,
    diff: str,
    head_branch: str | None = None,
    draft: bool = False,
) -> PullRequest:
    """Create a pull request from a diff string."""
    msg = f"{self.__class__.__name__} does not implement create_pull_request_from_diff"
    raise FeatureNotSupportedError(msg)

create_pull_request_from_diff_async async

create_pull_request_from_diff_async(
    title: str,
    body: str,
    base_branch: str,
    diff: str,
    head_branch: str | None = None,
    draft: bool = False,
) -> PullRequest

Create a pull request from a diff string asynchronously.

Source code in src/githarbor/core/base.py
async def create_pull_request_from_diff_async(
    self,
    title: str,
    body: str,
    base_branch: str,
    diff: str,
    head_branch: str | None = None,
    draft: bool = False,
) -> PullRequest:
    """Create a pull request from a diff string asynchronously."""
    fn_name = "create_pull_request_from_diff_async"
    msg = f"{self.__class__.__name__} does not implement {fn_name}"
    raise FeatureNotSupportedError(msg)

download_async async

download_async(path: str, destination: JoinablePathLike, recursive: bool = False) -> None

Download repository content asynchronously.

Source code in src/githarbor/core/base.py
async def download_async(
    self,
    path: str,
    destination: JoinablePathLike,
    recursive: bool = False,
) -> None:
    """Download repository content asynchronously."""
    msg = f"{self.__class__.__name__} does not implement download_async"
    raise FeatureNotSupportedError(msg)

get_branch_async async

get_branch_async(name: str) -> Branch

Get branch information asynchronously.

Source code in src/githarbor/core/base.py
async def get_branch_async(self, name: str) -> Branch:
    """Get branch information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_branch_async"
    raise FeatureNotSupportedError(msg)

get_commit_async async

get_commit_async(sha: str) -> Commit

Get commit information asynchronously.

Source code in src/githarbor/core/base.py
async def get_commit_async(self, sha: str) -> Commit:
    """Get commit information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_commit_async"
    raise FeatureNotSupportedError(msg)

get_contributors_async async

get_contributors_async(
    sort_by: Literal["commits", "name", "date"] = "commits", limit: int | None = None
) -> list[User]

Get repository contributors asynchronously.

Source code in src/githarbor/core/base.py
async def get_contributors_async(
    self,
    sort_by: Literal["commits", "name", "date"] = "commits",
    limit: int | None = None,
) -> list[User]:
    """Get repository contributors asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_contributors_async"
    raise FeatureNotSupportedError(msg)

get_issue_async async

get_issue_async(issue_id: int) -> Issue

Get issue information asynchronously.

Source code in src/githarbor/core/base.py
async def get_issue_async(self, issue_id: int) -> Issue:
    """Get issue information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_issue_async"
    raise FeatureNotSupportedError(msg)

get_languages_async async

get_languages_async() -> dict[str, int]

Get repository language statistics asynchronously.

Source code in src/githarbor/core/base.py
async def get_languages_async(self) -> dict[str, int]:
    """Get repository language statistics asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_languages_async"
    raise FeatureNotSupportedError(msg)

get_latest_release_async async

get_latest_release_async(
    include_drafts: bool = False, include_prereleases: bool = False
) -> Release

Get latest release asynchronously.

Source code in src/githarbor/core/base.py
async def get_latest_release_async(
    self,
    include_drafts: bool = False,
    include_prereleases: bool = False,
) -> Release:
    """Get latest release asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_latest_release_async"
    raise FeatureNotSupportedError(msg)

get_pull_request_async async

get_pull_request_async(number: int) -> PullRequest

Get pull request information asynchronously.

Source code in src/githarbor/core/base.py
async def get_pull_request_async(self, number: int) -> PullRequest:
    """Get pull request information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_pull_request_async"
    raise FeatureNotSupportedError(msg)

get_release_async async

get_release_async(tag: str) -> Release

Get release by tag asynchronously.

Source code in src/githarbor/core/base.py
async def get_release_async(self, tag: str) -> Release:
    """Get release by tag asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_release_async"
    raise FeatureNotSupportedError(msg)

get_repo_user_async async

get_repo_user_async() -> User

Get repository owner information asynchronously.

Source code in src/githarbor/core/base.py
async def get_repo_user_async(self) -> User:
    """Get repository owner information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_repo_user_async"
    raise FeatureNotSupportedError(msg)

get_tag_async async

get_tag_async(name: str) -> Tag

Get tag information asynchronously.

Source code in src/githarbor/core/base.py
async def get_tag_async(self, name: str) -> Tag:
    """Get tag information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_tag_async"
    raise FeatureNotSupportedError(msg)

get_workflow_async async

get_workflow_async(workflow_id: str) -> Workflow

Get workflow information asynchronously.

Source code in src/githarbor/core/base.py
async def get_workflow_async(self, workflow_id: str) -> Workflow:
    """Get workflow information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_workflow_async"
    raise FeatureNotSupportedError(msg)

get_workflow_run_async async

get_workflow_run_async(run_id: str) -> WorkflowRun

Get workflow run information asynchronously.

Source code in src/githarbor/core/base.py
async def get_workflow_run_async(self, run_id: str) -> WorkflowRun:
    """Get workflow run information asynchronously."""
    msg = f"{self.__class__.__name__} does not implement get_workflow_run_async"
    raise FeatureNotSupportedError(msg)

list_branches_async async

list_branches_async() -> list[Branch]

List all branches asynchronously.

Source code in src/githarbor/core/base.py
async def list_branches_async(self) -> list[Branch]:
    """List all branches asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_branches_async"
    raise FeatureNotSupportedError(msg)

list_commits_async async

list_commits_async(
    branch: str | None = None,
    since: datetime | None = None,
    until: datetime | None = None,
    author: str | None = None,
    path: str | None = None,
    max_results: int | None = None,
) -> list[Commit]

List commits asynchronously.

Source code in src/githarbor/core/base.py
async def list_commits_async(
    self,
    branch: str | None = None,
    since: datetime | None = None,
    until: datetime | None = None,
    author: str | None = None,
    path: str | None = None,
    max_results: int | None = None,
) -> list[Commit]:
    """List commits asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_commits_async"
    raise FeatureNotSupportedError(msg)

list_issues_async async

list_issues_async(state: IssueState = 'open') -> list[Issue]

List issues asynchronously.

Source code in src/githarbor/core/base.py
async def list_issues_async(self, state: IssueState = "open") -> list[Issue]:
    """List issues asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_issues_async"
    raise FeatureNotSupportedError(msg)

list_pull_requests_async async

list_pull_requests_async(state: PullRequestState = 'open') -> list[PullRequest]

List pull requests asynchronously.

Source code in src/githarbor/core/base.py
async def list_pull_requests_async(
    self,
    state: PullRequestState = "open",
) -> list[PullRequest]:
    """List pull requests asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_pull_requests_async"
    raise FeatureNotSupportedError(msg)

list_releases_async async

list_releases_async(
    include_drafts: bool = False, include_prereleases: bool = False, limit: int | None = None
) -> list[Release]

List releases asynchronously.

Source code in src/githarbor/core/base.py
async def list_releases_async(
    self,
    include_drafts: bool = False,
    include_prereleases: bool = False,
    limit: int | None = None,
) -> list[Release]:
    """List releases asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_releases_async"
    raise FeatureNotSupportedError(msg)

list_tags_async async

list_tags_async() -> list[Tag]

List all tags asynchronously.

Source code in src/githarbor/core/base.py
async def list_tags_async(self) -> list[Tag]:
    """List all tags asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_tags_async"
    raise FeatureNotSupportedError(msg)

list_workflows_async async

list_workflows_async() -> list[Workflow]

List workflows asynchronously.

Source code in src/githarbor/core/base.py
async def list_workflows_async(self) -> list[Workflow]:
    """List workflows asynchronously."""
    msg = f"{self.__class__.__name__} does not implement list_workflows_async"
    raise FeatureNotSupportedError(msg)

search_commits_async async

search_commits_async(
    query: str, branch: str | None = None, path: str | None = None, max_results: int | None = None
) -> list[Commit]

Search commits asynchronously.

Source code in src/githarbor/core/base.py
async def search_commits_async(
    self,
    query: str,
    branch: str | None = None,
    path: str | None = None,
    max_results: int | None = None,
) -> list[Commit]:
    """Search commits asynchronously."""
    msg = f"{self.__class__.__name__} does not implement search_commits_async"
    raise FeatureNotSupportedError(msg)

Branch dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Branch:
    name: str
    """Name of the branch."""
    sha: str
    """SHA hash of the latest commit on this branch."""
    protected: bool = False
    """Whether the branch has protection rules enabled."""
    default: bool = False
    """Whether this is the default branch of the repository."""
    created_at: datetime | None = None
    """Date and time when the branch was created."""
    updated_at: datetime | None = None
    """Date and time when the branch was last updated."""
    last_commit_date: datetime | None = None
    """Date of the last commit."""
    last_commit_message: str | None = None
    """Message of the last commit."""
    last_commit_author: User | None = None
    """Author of the last commit."""
    protection_rules: dict[str, Any] | None = None
    """Branch protection settings if any."""

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the branch was created.

default class-attribute instance-attribute

default: bool = False

Whether this is the default branch of the repository.

last_commit_author class-attribute instance-attribute

last_commit_author: User | None = None

Author of the last commit.

last_commit_date class-attribute instance-attribute

last_commit_date: datetime | None = None

Date of the last commit.

last_commit_message class-attribute instance-attribute

last_commit_message: str | None = None

Message of the last commit.

name instance-attribute

name: str

Name of the branch.

protected class-attribute instance-attribute

protected: bool = False

Whether the branch has protection rules enabled.

protection_rules class-attribute instance-attribute

protection_rules: dict[str, Any] | None = None

Branch protection settings if any.

sha instance-attribute

sha: str

SHA hash of the latest commit on this branch.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the branch was last updated.

Comment dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Comment:
    id: str
    """Unique identifier for the comment."""
    body: str
    """Content of the comment."""
    author: User
    """User who wrote the comment."""
    created_at: datetime
    """Date and time when the comment was created."""
    updated_at: datetime | None = None
    """Date and time when the comment was last updated."""
    reactions: dict[str, int] = field(default_factory=dict)
    """Dictionary of reaction types and their counts."""
    reply_to: str | None = None  # ID of parent comment if this is a reply
    """ID of parent comment if this is a reply."""
    url: str | None = None
    """URL to the comment."""

author instance-attribute

author: User

User who wrote the comment.

body instance-attribute

body: str

Content of the comment.

created_at instance-attribute

created_at: datetime

Date and time when the comment was created.

id instance-attribute

id: str

Unique identifier for the comment.

reactions class-attribute instance-attribute

reactions: dict[str, int] = field(default_factory=dict)

Dictionary of reaction types and their counts.

reply_to class-attribute instance-attribute

reply_to: str | None = None

ID of parent comment if this is a reply.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the comment was last updated.

url class-attribute instance-attribute

url: str | None = None

URL to the comment.

Commit dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Commit:
    sha: str
    """Unique identifier for the commit."""
    message: str
    """Commit message."""
    author: User | None = None
    """User who authored the commit."""
    created_at: datetime | None = None
    """Date and time when the commit was authored."""
    committer: User | None = None
    """User who committed the changes."""
    url: str | None = None
    """URL to the commit details."""
    stats: dict[str, int] = field(default_factory=dict)
    """Commit statistics."""
    parents: list[str] = field(default_factory=list)
    """List of parent commit SHAs."""
    verified: bool = False
    """Signature verification status."""
    files_changed: list[str] = field(default_factory=list)
    """Changed file paths."""

author class-attribute instance-attribute

author: User | None = None

User who authored the commit.

committer class-attribute instance-attribute

committer: User | None = None

User who committed the changes.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the commit was authored.

files_changed class-attribute instance-attribute

files_changed: list[str] = field(default_factory=list)

Changed file paths.

message instance-attribute

message: str

Commit message.

parents class-attribute instance-attribute

parents: list[str] = field(default_factory=list)

List of parent commit SHAs.

sha instance-attribute

sha: str

Unique identifier for the commit.

stats class-attribute instance-attribute

stats: dict[str, int] = field(default_factory=dict)

Commit statistics.

url class-attribute instance-attribute

url: str | None = None

URL to the commit details.

verified class-attribute instance-attribute

verified: bool = False

Signature verification status.

GitHarborError

Bases: Exception

Base exception for GitHarbor.

Source code in src/githarbor/exceptions.py
class GitHarborError(Exception):
    """Base exception for GitHarbor."""

Issue dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Issue:
    number: int
    """Unique identifier for the issue."""
    title: str
    """Title of the issue."""
    description: str = ""
    """Description of the issue."""
    state: str = "open"
    """State of the issue."""
    author: User | None = None
    """User who created the issue."""
    assignee: User | None = None
    """User who is assigned to the issue."""
    labels: list[Label] = field(default_factory=list)
    """List of labels attached to the issue."""
    created_at: datetime | None = None
    """Date and time when the issue was created."""
    updated_at: datetime | None = None
    """Date and time when the issue was last updated."""
    closed_at: datetime | None = None
    """Date and time when the issue was closed."""
    closed: bool = False
    """Indicates if the issue is closed."""
    comments_count: int = 0
    """Number of comments."""
    url: str | None = None
    """URL to the issue."""
    milestone: str | None = None
    """Associated milestone."""

assignee class-attribute instance-attribute

assignee: User | None = None

User who is assigned to the issue.

author class-attribute instance-attribute

author: User | None = None

User who created the issue.

closed class-attribute instance-attribute

closed: bool = False

Indicates if the issue is closed.

closed_at class-attribute instance-attribute

closed_at: datetime | None = None

Date and time when the issue was closed.

comments_count class-attribute instance-attribute

comments_count: int = 0

Number of comments.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the issue was created.

description class-attribute instance-attribute

description: str = ''

Description of the issue.

labels class-attribute instance-attribute

labels: list[Label] = field(default_factory=list)

List of labels attached to the issue.

milestone class-attribute instance-attribute

milestone: str | None = None

Associated milestone.

number instance-attribute

number: int

Unique identifier for the issue.

state class-attribute instance-attribute

state: str = 'open'

State of the issue.

title instance-attribute

title: str

Title of the issue.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the issue was last updated.

url class-attribute instance-attribute

url: str | None = None

URL to the issue.

Label dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Label:
    name: str
    """Name of the label."""
    color: str = ""  # Hex color code
    """Hex color code for the label."""
    description: str = ""
    """Description of what the label represents."""
    created_at: datetime | None = None
    """Date and time when the label was created."""
    updated_at: datetime | None = None
    """Date and time when the label was last updated."""
    url: str | None = None
    """URL to the label."""

color class-attribute instance-attribute

color: str = ''

Hex color code for the label.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the label was created.

description class-attribute instance-attribute

description: str = ''

Description of what the label represents.

name instance-attribute

name: str

Name of the label.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the label was last updated.

url class-attribute instance-attribute

url: str | None = None

URL to the label.

OperationNotAllowedError

Bases: GitHarborError

Raised when an operation is not allowed.

Source code in src/githarbor/exceptions.py
class OperationNotAllowedError(GitHarborError):
    """Raised when an operation is not allowed."""

ProviderNotConfiguredError

Bases: GitHarborError

Raised when provider is not properly configured (missing token etc).

Source code in src/githarbor/exceptions.py
class ProviderNotConfiguredError(GitHarborError):
    """Raised when provider is not properly configured (missing token etc)."""

PullRequest dataclass

Pull request model.

Source code in src/githarbor/core/models.py
@dataclass
class PullRequest:
    """Pull request model."""

    number: int
    """Pull request number."""
    title: str
    """Title of the pull request."""
    source_branch: str
    """Branch containing the changes."""
    target_branch: str
    """Branch to merge into."""
    description: str = ""
    """Description/body of the pull request."""
    state: str | None = None
    """Current state (open/closed/merged)."""
    created_at: datetime | None = None
    """Creation timestamp."""
    updated_at: datetime | None = None
    """Last update timestamp."""
    merged_at: datetime | None = None
    """Merge timestamp if merged."""
    closed_at: datetime | None = None
    """Closing timestamp if closed."""
    author: User | None = None
    """PR creator."""
    assignees: list[User] = field(default_factory=list)
    """Assigned reviewers."""
    labels: list[Label] = field(default_factory=list)
    """Applied labels."""
    comments: list[Comment] = field(default_factory=list)
    """PR comments."""
    merged_by: User | None = None
    """User who merged the PR."""
    review_comments_count: int | None = None
    """Number of review comments."""
    commits_count: int | None = None
    """Number of commits."""
    additions: int | None = None
    """Lines added."""
    deletions: int | None = None
    """Lines deleted."""
    changed_files: int | None = None
    """Number of files changed."""
    mergeable: bool | None = None
    """Whether PR can be merged."""
    url: str | None = None
    """URL to the PR."""

additions class-attribute instance-attribute

additions: int | None = None

Lines added.

assignees class-attribute instance-attribute

assignees: list[User] = field(default_factory=list)

Assigned reviewers.

author class-attribute instance-attribute

author: User | None = None

PR creator.

changed_files class-attribute instance-attribute

changed_files: int | None = None

Number of files changed.

closed_at class-attribute instance-attribute

closed_at: datetime | None = None

Closing timestamp if closed.

comments class-attribute instance-attribute

comments: list[Comment] = field(default_factory=list)

PR comments.

commits_count class-attribute instance-attribute

commits_count: int | None = None

Number of commits.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Creation timestamp.

deletions class-attribute instance-attribute

deletions: int | None = None

Lines deleted.

description class-attribute instance-attribute

description: str = ''

Description/body of the pull request.

labels class-attribute instance-attribute

labels: list[Label] = field(default_factory=list)

Applied labels.

mergeable class-attribute instance-attribute

mergeable: bool | None = None

Whether PR can be merged.

merged_at class-attribute instance-attribute

merged_at: datetime | None = None

Merge timestamp if merged.

merged_by class-attribute instance-attribute

merged_by: User | None = None

User who merged the PR.

number instance-attribute

number: int

Pull request number.

review_comments_count class-attribute instance-attribute

review_comments_count: int | None = None

Number of review comments.

source_branch instance-attribute

source_branch: str

Branch containing the changes.

state class-attribute instance-attribute

state: str | None = None

Current state (open/closed/merged).

target_branch instance-attribute

target_branch: str

Branch to merge into.

title instance-attribute

title: str

Title of the pull request.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Last update timestamp.

url class-attribute instance-attribute

url: str | None = None

URL to the PR.

RateLimitError

Bases: GitHarborError

Raised when API rate limit is exceeded.

Source code in src/githarbor/exceptions.py
class RateLimitError(GitHarborError):
    """Raised when API rate limit is exceeded."""

Release dataclass

Model representing a repository release.

Source code in src/githarbor/core/models.py
@dataclass
class Release:
    """Model representing a repository release."""

    tag_name: str
    """Tag name for the release."""
    name: str
    """Name/title of the release."""
    description: str = ""
    """Description/body of the release."""
    created_at: datetime | None = None
    """Date and time when the release was created."""
    published_at: datetime | None = None
    """Date and time when the release was published."""
    draft: bool = False
    """Whether this is a draft release."""
    prerelease: bool = False
    """Whether this is a pre-release."""
    author: User | None = None
    """User who created the release."""
    assets: list[Asset] = field(default_factory=list)
    """List of assets attached to the release."""
    url: str | None = None
    """URL to view the release."""
    target_commitish: str | None = None
    """The branch/tag/commit the release targets."""
    download_count: int = 0
    """Total downloads."""

assets class-attribute instance-attribute

assets: list[Asset] = field(default_factory=list)

List of assets attached to the release.

author class-attribute instance-attribute

author: User | None = None

User who created the release.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the release was created.

description class-attribute instance-attribute

description: str = ''

Description/body of the release.

download_count class-attribute instance-attribute

download_count: int = 0

Total downloads.

draft class-attribute instance-attribute

draft: bool = False

Whether this is a draft release.

name instance-attribute

name: str

Name/title of the release.

prerelease class-attribute instance-attribute

prerelease: bool = False

Whether this is a pre-release.

published_at class-attribute instance-attribute

published_at: datetime | None = None

Date and time when the release was published.

tag_name instance-attribute

tag_name: str

Tag name for the release.

target_commitish class-attribute instance-attribute

target_commitish: str | None = None

The branch/tag/commit the release targets.

url class-attribute instance-attribute

url: str | None = None

URL to view the release.

RepositoryNotFoundError

Bases: GitHarborError

Raised when a repository cannot be found.

Source code in src/githarbor/exceptions.py
class RepositoryNotFoundError(GitHarborError):
    """Raised when a repository cannot be found."""

ResourceNotFoundError

Bases: GitHarborError

Raised when a requested resource is not found.

Source code in src/githarbor/exceptions.py
class ResourceNotFoundError(GitHarborError):
    """Raised when a requested resource is not found."""

User dataclass

User or organization account on a Git hosting platform.

Source code in src/githarbor/core/models.py
@dataclass
class User:
    """User or organization account on a Git hosting platform."""

    username: str
    """Username of the user."""
    name: str | None = None
    """Full name of the user."""
    email: str | None = None
    """Email address of the user."""
    avatar_url: str | None = None
    """URL of the user's avatar image."""
    created_at: datetime | None = None
    """Date and time when the user account was created."""
    bio: str | None = None
    """Biography/description of the user."""
    location: str | None = None
    """Geographic location of the user."""
    company: str | None = None
    """Company/organization the user belongs to."""
    state: str | None = None
    """State of the user (active / inactive)."""
    locked: bool | None = None
    """Whether user is locked."""
    followers: int | None = None
    """Number of followers."""
    following: int | None = None
    """Number of users being followed."""
    public_repos: int | None = None
    """Number of public repositories."""
    url: str | None = None
    """URL to user's profile."""
    blog: str | None = None
    """Personal blog of this user"""
    twitter_username: str | None = None
    """X / Twitter username of this user"""
    hireable: bool | None = None
    """Whether user is available for hiring"""
    gravatar_id: str | None = None
    """Gravatar id for this user."""
    is_admin: bool | None = None
    """Whether the user has admin privileges."""
    last_activity_on: datetime | None = None
    """Date of last activity."""
    linkedin: str | None = None
    """LinkedIn username."""
    skype: str | None = None
    """Skype username."""

avatar_url class-attribute instance-attribute

avatar_url: str | None = None

URL of the user's avatar image.

bio class-attribute instance-attribute

bio: str | None = None

Biography/description of the user.

blog class-attribute instance-attribute

blog: str | None = None

Personal blog of this user

company class-attribute instance-attribute

company: str | None = None

Company/organization the user belongs to.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the user account was created.

email class-attribute instance-attribute

email: str | None = None

Email address of the user.

followers class-attribute instance-attribute

followers: int | None = None

Number of followers.

following class-attribute instance-attribute

following: int | None = None

Number of users being followed.

gravatar_id class-attribute instance-attribute

gravatar_id: str | None = None

Gravatar id for this user.

hireable class-attribute instance-attribute

hireable: bool | None = None

Whether user is available for hiring

is_admin class-attribute instance-attribute

is_admin: bool | None = None

Whether the user has admin privileges.

last_activity_on class-attribute instance-attribute

last_activity_on: datetime | None = None

Date of last activity.

linkedin class-attribute instance-attribute

linkedin: str | None = None

LinkedIn username.

location class-attribute instance-attribute

location: str | None = None

Geographic location of the user.

locked class-attribute instance-attribute

locked: bool | None = None

Whether user is locked.

name class-attribute instance-attribute

name: str | None = None

Full name of the user.

public_repos class-attribute instance-attribute

public_repos: int | None = None

Number of public repositories.

skype class-attribute instance-attribute

skype: str | None = None

Skype username.

state class-attribute instance-attribute

state: str | None = None

State of the user (active / inactive).

twitter_username class-attribute instance-attribute

twitter_username: str | None = None

X / Twitter username of this user

url class-attribute instance-attribute

url: str | None = None

URL to user's profile.

username instance-attribute

username: str

Username of the user.

Workflow dataclass

Source code in src/githarbor/core/models.py
@dataclass
class Workflow:
    id: str
    """Unique identifier for the workflow."""
    name: str
    """Name of the workflow."""
    path: str
    """Path to the workflow file in the repository."""
    state: str
    """State of the workflow."""
    created_at: datetime | None = None
    """Date and time when the workflow was created."""
    updated_at: datetime | None = None
    """Date and time when the workflow was last updated."""
    description: str = ""
    """Description of the workflow."""
    triggers: list[str] = field(default_factory=list)
    """List of triggers that can start the workflow."""
    disabled: bool = False
    """Indicates if the workflow is disabled."""
    last_run_at: datetime | None = None
    """Date and time when the workflow was last run."""
    badge_url: str | None = None
    """URL to the badge image for the workflow."""
    definition: str | None = None
    """Content of the workflow definition file."""
    runs_count: int = 0
    """Total number of runs."""
    success_count: int = 0
    """Successful runs count."""

badge_url class-attribute instance-attribute

badge_url: str | None = None

URL to the badge image for the workflow.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the workflow was created.

definition class-attribute instance-attribute

definition: str | None = None

Content of the workflow definition file.

description class-attribute instance-attribute

description: str = ''

Description of the workflow.

disabled class-attribute instance-attribute

disabled: bool = False

Indicates if the workflow is disabled.

id instance-attribute

id: str

Unique identifier for the workflow.

last_run_at class-attribute instance-attribute

last_run_at: datetime | None = None

Date and time when the workflow was last run.

name instance-attribute

name: str

Name of the workflow.

path instance-attribute

path: str

Path to the workflow file in the repository.

runs_count class-attribute instance-attribute

runs_count: int = 0

Total number of runs.

state instance-attribute

state: str

State of the workflow.

success_count class-attribute instance-attribute

success_count: int = 0

Successful runs count.

triggers class-attribute instance-attribute

triggers: list[str] = field(default_factory=list)

List of triggers that can start the workflow.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the workflow was last updated.

WorkflowRun dataclass

Source code in src/githarbor/core/models.py
@dataclass
class WorkflowRun:
    id: str
    """Unique identifier for the workflow run."""
    name: str
    """Name of the workflow run."""
    workflow_id: str
    """ID of the parent workflow."""
    status: str
    """Current status of the workflow run."""
    conclusion: str | None
    """Final conclusion of the workflow run."""
    branch: str | None = None
    """Branch the workflow was run on."""
    commit_sha: str | None = None
    """SHA of the commit that triggered the workflow."""
    url: str | None = None
    """URL to view the workflow run."""
    created_at: datetime | None = None
    """Date and time when the workflow run was created."""
    updated_at: datetime | None = None
    """Date and time when the workflow run was last updated."""
    started_at: datetime | None = None
    """Date and time when the workflow run started."""
    completed_at: datetime | None = None
    """Date and time when the workflow run completed."""
    run_number: int | None = None
    """Sequential run number."""
    jobs_count: int | None = None
    """Total jobs count."""
    logs_url: str | None = None
    """Logs URL."""

branch class-attribute instance-attribute

branch: str | None = None

Branch the workflow was run on.

commit_sha class-attribute instance-attribute

commit_sha: str | None = None

SHA of the commit that triggered the workflow.

completed_at class-attribute instance-attribute

completed_at: datetime | None = None

Date and time when the workflow run completed.

conclusion instance-attribute

conclusion: str | None

Final conclusion of the workflow run.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Date and time when the workflow run was created.

id instance-attribute

id: str

Unique identifier for the workflow run.

jobs_count class-attribute instance-attribute

jobs_count: int | None = None

Total jobs count.

logs_url class-attribute instance-attribute

logs_url: str | None = None

Logs URL.

name instance-attribute

name: str

Name of the workflow run.

run_number class-attribute instance-attribute

run_number: int | None = None

Sequential run number.

started_at class-attribute instance-attribute

started_at: datetime | None = None

Date and time when the workflow run started.

status instance-attribute

status: str

Current status of the workflow run.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Date and time when the workflow run was last updated.

url class-attribute instance-attribute

url: str | None = None

URL to view the workflow run.

workflow_id instance-attribute

workflow_id: str

ID of the parent workflow.

create_repository

create_repository(url: str, **kwargs: Any) -> Repository

Create a proxy-wrapped repository instance from a URL.

Parameters:

Name Type Description Default
url str

The repository URL (e.g. 'https://github.com/owner/repo')

required
**kwargs Any

Repository-specific configuration (tokens, credentials, etc.)

{}

Returns:

Name Type Description
Repository Repository

Proxy-wrapped repository instance

Raises:

Type Description
RepositoryNotFoundError

If the URL isn't supported or no repository found

Example

repo = create_repository('https://github.com/owner/repo', token='my-token') issues = repo.list_issues()

Source code in src/githarbor/repositories.py
def create_repository(url: str, **kwargs: Any) -> Repository:
    """Create a proxy-wrapped repository instance from a URL.

    Args:
        url: The repository URL (e.g. 'https://github.com/owner/repo')
        **kwargs: Repository-specific configuration (tokens, credentials, etc.)

    Returns:
        Repository: Proxy-wrapped repository instance

    Raises:
        RepositoryNotFoundError: If the URL isn't supported or no repository found

    Example:
        >>> repo = create_repository('https://github.com/owner/repo', token='my-token')
        >>> issues = repo.list_issues()
    """
    try:
        return RepoRegistry.from_url(url, **kwargs)
    except Exception as e:
        msg = f"Failed to create repository from {url}: {e!s}"
        raise RepositoryNotFoundError(msg) from e