-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎉 Source GitHub: Add option to pull commits from user-specified branches #6223
Conversation
…branch-specific value
/test connector=connectors/source-github
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
airbyte-integrations/connectors/source-github/source_github/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-github/source_github/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-github/source_github/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-github/source_github/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-github/source_github/source.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-github/source_github/source.py
Outdated
Show resolved
Hide resolved
/test connector=connectors/source-github
|
/test connector=connectors/source-github
|
default_branches.update( | ||
{ | ||
repo_stats["full_name"]: repo_stats["default_branch"] | ||
for repo_stats in repository_stats_stream.read_records(sync_mode=SyncMode.full_refresh, stream_slice=stream_slice) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry can you explain what this for loop is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get the default branch for each of the repositories, so that if nothing is specified in the branches
parameter in spec.json
, then use it.
if current_stream_state.get(current_repository): | ||
repository_commits_state = current_stream_state[current_repository] | ||
if repository_commits_state.get(self.cursor_field): | ||
# transfer state from old source version to per-branch version | ||
if current_branch == self.default_branches[current_repository]: | ||
state_value = max(latest_cursor_value, repository_commits_state[self.cursor_field]) | ||
del repository_commits_state[self.cursor_field] | ||
elif repository_commits_state.get(current_branch, {}).get(self.cursor_field): | ||
state_value = max(latest_cursor_value, repository_commits_state[current_branch][self.cursor_field]) | ||
if current_repository not in current_stream_state: | ||
current_stream_state[current_repository] = {} | ||
current_stream_state[current_repository][current_branch] = {self.cursor_field: state_value} | ||
return current_stream_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if current_stream_state.get(current_repository): | |
repository_commits_state = current_stream_state[current_repository] | |
if repository_commits_state.get(self.cursor_field): | |
# transfer state from old source version to per-branch version | |
if current_branch == self.default_branches[current_repository]: | |
state_value = max(latest_cursor_value, repository_commits_state[self.cursor_field]) | |
del repository_commits_state[self.cursor_field] | |
elif repository_commits_state.get(current_branch, {}).get(self.cursor_field): | |
state_value = max(latest_cursor_value, repository_commits_state[current_branch][self.cursor_field]) | |
if current_repository not in current_stream_state: | |
current_stream_state[current_repository] = {} | |
current_stream_state[current_repository][current_branch] = {self.cursor_field: state_value} | |
return current_stream_state | |
if current_stream_state.get(current_repository): | |
repository_commits_state = current_stream_state[current_repository] | |
if repository_commits_state.get(self.cursor_field): | |
# transfer state from old source version to per-branch version | |
if current_branch == self.default_branches[current_repository]: | |
state_value = max(latest_cursor_value, repository_commits_state[self.cursor_field]) | |
del repository_commits_state[self.cursor_field] | |
elif repository_commits_state.get(current_branch, {}).get(self.cursor_field): | |
state_value = max(latest_cursor_value, repository_commits_state[current_branch][self.cursor_field]) | |
if current_repository not in current_stream_state: | |
current_stream_state[current_repository] = {} | |
current_stream_state[current_repository][current_branch] = {self.cursor_field: state_value} | |
return current_stream_state |
@yevhenii-ldv nice! I think you might be missing a dockerfile update, otherwise looks good. |
/publish connector=connectors/source-github
|
What
copy of #5931.
How
Describe the solution
Recommended reading order
x.java
y.python
Pre-merge Checklist
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described here