airbyte-source-github 2.1.8__tar.gz → 2.2.0.dev202601122028__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/PKG-INFO +1 -1
  2. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/pyproject.toml +1 -1
  3. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/source.py +2 -0
  4. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/streams.py +71 -0
  5. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/README.md +0 -0
  6. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/__init__.py +0 -0
  7. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/backoff_strategies.py +0 -0
  8. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/config_migrations.py +0 -0
  9. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/constants.py +0 -0
  10. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/errors_handlers.py +0 -0
  11. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/github_schema.py +0 -0
  12. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/graphql.py +0 -0
  13. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/run.py +0 -0
  14. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/assignees.json +0 -0
  15. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/branches.json +0 -0
  16. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/collaborators.json +0 -0
  17. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/comments.json +0 -0
  18. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/commit_comment_reactions.json +0 -0
  19. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/commit_comments.json +0 -0
  20. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/commits.json +0 -0
  21. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/contributor_activity.json +0 -0
  22. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/deployments.json +0 -0
  23. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/events.json +0 -0
  24. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_comment_reactions.json +0 -0
  25. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_events.json +0 -0
  26. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_labels.json +0 -0
  27. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_milestones.json +0 -0
  28. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_reactions.json +0 -0
  29. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issue_timeline_events.json +0 -0
  30. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/issues.json +0 -0
  31. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/organizations.json +0 -0
  32. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/project_cards.json +0 -0
  33. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/project_columns.json +0 -0
  34. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/projects.json +0 -0
  35. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/projects_v2.json +0 -0
  36. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/pull_request_comment_reactions.json +0 -0
  37. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/pull_request_commits.json +0 -0
  38. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/pull_request_stats.json +0 -0
  39. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/pull_requests.json +0 -0
  40. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/releases.json +0 -0
  41. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/repositories.json +0 -0
  42. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/review_comments.json +0 -0
  43. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/reviews.json +0 -0
  44. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/events/comment.json +0 -0
  45. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/events/commented.json +0 -0
  46. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/events/committed.json +0 -0
  47. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/events/cross_referenced.json +0 -0
  48. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/events/reviewed.json +0 -0
  49. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/reaction.json +0 -0
  50. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/reactions.json +0 -0
  51. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/user.json +0 -0
  52. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/shared/user_graphql.json +0 -0
  53. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/stargazers.json +0 -0
  54. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/tags.json +0 -0
  55. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/team_members.json +0 -0
  56. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/team_memberships.json +0 -0
  57. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/teams.json +0 -0
  58. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/users.json +0 -0
  59. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/workflow_jobs.json +0 -0
  60. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/workflow_runs.json +0 -0
  61. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/schemas/workflows.json +0 -0
  62. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/spec.json +0 -0
  63. {airbyte_source_github-2.1.8 → airbyte_source_github-2.2.0.dev202601122028}/source_github/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-source-github
3
- Version: 2.1.8
3
+ Version: 2.2.0.dev202601122028
4
4
  Summary: Source implementation for GitHub.
5
5
  Home-page: https://airbyte.com
6
6
  License: ELv2
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
3
3
  build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
- version = "2.1.8"
6
+ version = "2.2.0.dev.202601122028"
7
7
  name = "airbyte-source-github"
8
8
  description = "Source implementation for GitHub."
9
9
  authors = [ "Airbyte <contact@airbyte.io>",]
@@ -54,6 +54,7 @@ from .streams import (
54
54
  Teams,
55
55
  Users,
56
56
  WorkflowJobs,
57
+ WorkflowRunAttempts,
57
58
  WorkflowRuns,
58
59
  Workflows,
59
60
  )
@@ -309,5 +310,6 @@ class SourceGithub(AbstractSource):
309
310
  Workflows(**repository_args_with_start_date),
310
311
  workflow_runs_stream,
311
312
  WorkflowJobs(parent=workflow_runs_stream, **repository_args_with_start_date),
313
+ WorkflowRunAttempts(parent=workflow_runs_stream, **repository_args_with_start_date),
312
314
  TeamMemberships(parent=team_members_stream, **repository_args),
313
315
  ]
@@ -1506,6 +1506,77 @@ class WorkflowRuns(SemiIncrementalMixin, GithubStream):
1506
1506
  self.state = new_state
1507
1507
 
1508
1508
 
1509
+ class WorkflowRunAttempts(SemiIncrementalMixin, GithubStream):
1510
+ """
1511
+ Get all workflow run attempts for a GitHub repository.
1512
+ This stream fetches every attempt of each workflow run, allowing users to track re-runs.
1513
+ API documentation: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run-attempt
1514
+ """
1515
+
1516
+ primary_key = ["id", "run_attempt"]
1517
+
1518
+ # key for accessing slice value from record
1519
+ record_slice_key = ["repository", "full_name"]
1520
+
1521
+ # https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs
1522
+ re_run_period = 32 # days
1523
+
1524
+ def __init__(self, parent: WorkflowRuns, **kwargs):
1525
+ super().__init__(**kwargs)
1526
+ self.parent = parent
1527
+
1528
+ def stream_slices(
1529
+ self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
1530
+ ) -> Iterable[Optional[Mapping[str, Any]]]:
1531
+ # First get all workflow runs, then for each run we'll fetch all attempts
1532
+ parent_stream_slices = self.parent.stream_slices(
1533
+ sync_mode=SyncMode.full_refresh, cursor_field=cursor_field, stream_state=stream_state
1534
+ )
1535
+ for stream_slice in parent_stream_slices:
1536
+ parent_records = self.parent.read_records(
1537
+ sync_mode=SyncMode.full_refresh, cursor_field=cursor_field, stream_slice=stream_slice, stream_state=stream_state
1538
+ )
1539
+ for parent_record in parent_records:
1540
+ # For each workflow run, create slices for each attempt
1541
+ run_id = parent_record["id"]
1542
+ run_attempt = parent_record["run_attempt"] # This tells us the max attempt number
1543
+ for attempt_num in range(1, run_attempt + 1):
1544
+ yield {"repository": stream_slice["repository"], "run_id": run_id, "attempt_number": attempt_num}
1545
+
1546
+ def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
1547
+ return f"repos/{stream_slice['repository']}/actions/runs/{stream_slice['run_id']}/attempts/{stream_slice['attempt_number']}"
1548
+
1549
+ def parse_response(self, response: requests.Response, stream_slice: Mapping[str, Any] = None, **kwargs) -> Iterable[Mapping]:
1550
+ # The attempts endpoint returns a single workflow run object, not an array
1551
+ record = response.json()
1552
+ yield record
1553
+
1554
+ def read_records(
1555
+ self,
1556
+ sync_mode: SyncMode,
1557
+ cursor_field: List[str] = None,
1558
+ stream_slice: Mapping[str, Any] = None,
1559
+ stream_state: Mapping[str, Any] = None,
1560
+ ) -> Iterable[Mapping[str, Any]]:
1561
+ # Similar logic to WorkflowRuns for handling incremental sync with re-run period
1562
+ start_point = self.get_starting_point(stream_state=stream_state, stream_slice=stream_slice)
1563
+ break_point = None
1564
+ new_state = self.state
1565
+ if start_point:
1566
+ break_point = (ab_datetime_parse(start_point) - timedelta(days=self.re_run_period)).isoformat()
1567
+ for record in super(SemiIncrementalMixin, self).read_records(
1568
+ sync_mode=sync_mode, cursor_field=cursor_field, stream_slice=stream_slice, stream_state=stream_state
1569
+ ):
1570
+ cursor_value = record[self.cursor_field]
1571
+ created_at = record["created_at"]
1572
+ if not start_point or cursor_value > start_point:
1573
+ yield record
1574
+ new_state = self._get_updated_state(new_state, record)
1575
+ if break_point and created_at < break_point:
1576
+ break
1577
+ self.state = new_state
1578
+
1579
+
1509
1580
  class WorkflowJobs(SemiIncrementalMixin, GithubStream):
1510
1581
  """
1511
1582
  Get all workflow jobs for a workflow run